top/contents search

17. Style

17.1 What's the best style for code layout in C?

17.2 How should functions be apportioned among source files?

17.3 Here's a neat trick for checking whether two strings are equal:

if(!strcmp(s1, s2))
Is this good style?

17.4 Why do some people write if(0 == x) instead of if(x == 0)?

17.4b I've seen function declarations that look like this:

extern int func __((int, int));
What are those extra parentheses and underscores for?

17.5 I came across some code that puts a (void) cast before each call to printf. Why?

17.6 If NULL and 0 are equivalent as null pointer constants, which should I use?

17.7 Should I use symbolic names like TRUE and FALSE for Boolean constants, or plain 1 and 0?

17.8 What is ``Hungarian Notation''? Is it worthwhile?

17.9 Where can I get the ``Indian Hill Style Guide'' and other coding standards?

17.10 Some people say that goto's are evil and that I should never use them. Isn't that a bit extreme?

17.11 People always say that good style is important, but when they go out of their way to use clear techniques and make their programs readable, they seem to end up with less efficient programs. Since efficiency is so important, isn't it necessary to sacrifice some style and readability?

17.12 Which is correct,

char *p
char* p


contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North