The Ten Commandments for C Programmers

صورة strontium90
أرسل من قبل strontium90 في السبت, 2005/11/19 - 8:29pm.

 
Interesting read, though some of it is hopelessly prehistoric, but much of it still pertains to current programming practice.
There's another for C++, but I didn't quite like it. It says nothing about generic programming and error handling strategies.
 


خيارات عرض التعليقات

اختر طريقتك المفضلة لعرض التعليقات و اضغط "حفظ الإعدادات" لتفعيل تغييراتك.
صورة foaad
أرسل من قبل foaad في الأحد, 2005/11/20 - 2:00am.

Thou shalt not use prehistoric programming languages Mr. Green
(just kidding don't kill me)


صورة strontium90
أرسل من قبل strontium90 في الأحد, 2005/11/20 - 3:44am.

 
Thou shalt exterminate all those blasphemous heathens who badmouth God's programming language*.
 
*definition appears in Glossary of OpenGL Programmers Guide aka The Red Book.


صورة strontium90
أرسل من قبل strontium90 في الإثنين, 2005/11/21 - 3:57pm.

Y'know what, foaad? While there indeed are some prehistoric languages, the concern is more about prehistoric programming practice in general high level code as a result of ignorance of better alternatives a certain programming language provides. More specifically I'm hinting at C++ high-level code (as opposed to code that deals with system intricacies) which counts on static built-in data structures, bound checking, explicit memory management, pointer arithmetic etc. This plain wrong style is more often than not dictated by textbooks and ignorant educationists.
Just for the sake of the example, a task as simple as reading character strings from the standard intput and appending them to a linear data structure, which can elegantly be expressed as:
    vector<string> v ;
    string buffer ;
    while( cin >> buffer ) v.push_back( buffer ) ;

will inevitably require memory allocation/deallocation chores, bounds checking and the use of a linear data structure of pointers should a solution be expressed in bare-bones built-in facilities.

I'm not saying that low-level facilities are dangerous or useless, they're in fact crucial to high-performace implementations of high-level facilities and for system programming of course, but their use need not be an everyday task.
 


صورة foaad
أرسل من قبل foaad في الثلاثاء, 2005/11/22 - 1:11am.

I don't think binding your self to one particular programming language is very practical as I said before it all depends on what you're doing so for me it's always a question of "What Programming languages/Software system should I use for this task?" not "What is the best Programming language/Software system?"
You could have more than one right answer for the first question, and there is no right answer for second one.

BTW plz don't say things like the above definition from the Red Book. You know why


صورة strontium90
أرسل من قبل strontium90 في الثلاثاء, 2005/11/22 - 2:25am.

كتب foaad:
I don't think binding your self to one particular programming language is very practical as I said before it all depends on what you're doing so for me it's always a question of "What Programming languages/Software system should I use for this task?" not "What is the best Programming language/Software system?" You could have more than one right answer for the first question, and there is no right answer for second one.
Hey you were too quick to generalize and stray off. The context is C/C++ programming "practice" and not which language is "better" than the other. I didn't hint at any language comparison in the above.
 
كتب foaad:
BTW plz don't say things like the above definition from the Red Book. You know why
Well I don't see why, but I promise you won't read any such quotations or a bit too "intelligent" humour henceforward.