Re: '#include<stdio.h>' (without space) or '#include <stdio.h>' (with space)?



On Jan 4, 10:23 am, Jorgen Grahn <grahn+n...@xxxxxxxxxxxxxx> wrote:
On Mon, 2010-01-04, Peng Yu wrote:
It seems that "#include <stdio.h>" is widely used and I don't see many
real examples of "#include<stdio.h>" (without the space).

http://www.chris-lott.org/resources/cstyle/indhill-cstyle.html

"#include<stdio.h>" is also perfect legal in the current compile (I
use gcc 4.2.4 default options).

Why on earth do you do that?

"Default options" (which I read as "no options passed to the
compiler") means to gcc and other compilers "turn off various kinds of
warnings for illegal code, and silently accept all kinds of C language
dialects and odd extensions".

Asking questions here based on such experiments is normally a waste of
time. (In this specific case it makes no difference.)

I know that this is a minute
difference. But I'm still wondering why "#include<stdio.h>" is not the
popular case. Is it because that "#include<stdio.h>" was illegal (at
lease in K&R's book, I don't see an example use "#include<"), but
later on the C language grammar was relaxed?

People add spacing to their code to make it more readable. That is
surely the original reason you don't see #include<foo> or
#include"foo".

For those of us who started writing C code after 1975, I suspect the
reason is: everyone else adds spacing, so why should *my* code look
odd for no good purpose?

/Jorgen

--
  // Jorgen Grahn <grahn@  Oo  o.   .  .
\X/     snipabacken.se>   O  o   .
--
comp.lang.c.moderated - moderation address: c...@xxxxxxxxxxxx -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line.  Sorry.

Adds style and readability to code.
--
comp.lang.c.moderated - moderation address: clcm@xxxxxxxxxxxx -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
.



Relevant Pages

  • Re: Volatiles in assignment expressions
    ... Marking a variable volatile indicates to the compiler that the variable may be modified in ways which the compiler cannot predict. ... FYI, looking at the RTL isn't a great way to determine what the emitted code will look like, as there GCC has several optimisation steps which are performed when translating the RTL into machine-specific assembly. ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • The perils of mixing C compiled with different compilers into the same executable.
    ... it safe to combine C++ from one vendor compiler with C from GCC?". ... I know why it is not safe to combine C++ from different compiler, ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • Re: best idiom for freeing items from a list
    ... O_O Compared to you I'm really loosey goosey with my gcc flags. ... The course to take is to define a wrapper callback function, ... have an appropriate newsgroups line in your header for your mail to be seen, ... or the newsgroup name in square brackets in the subject line. ...
    (comp.lang.c.moderated)
  • Re: C90 penetration
    ... The gcc is supporting C90 so almost every platform is covered. ... a C compiler to compile a 20-line program they are interested in. ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • Re: hai problem with typecasting pointer to int
    ... Why compiler do not treats it as an error? ... have an appropriate newsgroups line in your header for your mail to be seen, ... or the newsgroup name in square brackets in the subject line. ...
    (comp.lang.c.moderated)