Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
2 style questions
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="The Real OS/2 Guy, post: 1693435"] Hm, an unexperient C programmer has to learn it anyway. So when h/sh/e fails over that ist time for him to learn more about C. At least not an argument. Dosn't mater what type p is. When one had used 'p' for thome type other as a pointer you would fall about that some point earlier and whine about the abstuse naming the programmer was using - even as the name p is allwowed for any data type the implicit thinking of an human programmer would assign that name to an pointer type, not struct, int or other. in an conditional expression any C programmer would assign an single variable name with C syntax human reads based on code content -------- ----------- if (x) is x TRUE? if (!x) is x false? if (x) is x 0/0x00/000/zero while (p) while pointer is valid? for (; y; ) while y is true? for (; y; ) has y reached 0? for (; !p; ) until pointer is valid ...... as s/h/e knows that C makes an implicite compare to (type) 0 it's more easy to read c = p ? *p++ : 0 as 'when p is valid then assign content of that p points to to c and increment the pointer, else assign 0 to c' as when 'p is NULL then pointer is valid and ....' Comparing explicite to (type)0 is done only by very unexperienced C programmers (and only if they have learned another programming language prior). A special case to hide malloc from to be visible, to make code more complicated by using wrappers around malloc, to make maintenance more complicate. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
2 style questions
Top