Re: C is too old? opinions?



Richard <rgrdev@xxxxxxxxx> writes:
"Charlie Gordon" <news@xxxxxxxxxxx> writes:

"jacob navia" <jacob@xxxxxxxxxxxxxxxx> a écrit dans le message de news:
46fa7a46$0$5101$ba4acef3@xxxxxxxxxxxxxxxxx
[...]
Why not

#pragma once

Chqrlie?

As others have mentioned, portability is an issue.
You insisted that this pragma is supported by many compilers, among which
gcc.
I cannot find any mention of it in the documentation for my current gcc
version 4.1.x.
If they support if, it is undocumented and probably deprecated.

So I will not use it..

Then don't. Easy. But for many C programmers who daily weigh up the
benefits of standard adherent C and "mainstream adopted" C it is not
such an easy decision. If I was building a code base for the main 3 PC
OS platforms and all the mainstream compilers used this pragma I know I
would use it.

It saves a little typing, at the expense of losing any guarantee that
it will continue to be supported, or even that it works exactly the
way you think it does. (As Chqrlie and I have both pointed out, gcc
doesn't even document it.) I don't see any great benefit from that.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.



Relevant Pages

  • Re: C is too old? opinions?
    ... You insisted that this pragma is supported by many compilers, ... I cannot find any mention of it in the documentation for my current gcc ... If they support if, it is undocumented and probably deprecated. ... And, of course, the bar software worked fine. ...
    (comp.lang.c)
  • Re: Correspondence between headers and macros
    ... So Norcroft doesn't support "#pragma once". ... Supported by some, but not all compilers. ... CPP supports two more ways of indicating that a header file should ...
    (comp.lang.c)
  • Re: Interview with Mr Stroustrup
    ... perfect implementations of C99: ... decade on) starting to get C99- compilers. ... portable threading support. ... Support for closures (AFAIK gcc already supports them). ...
    (comp.lang.c)
  • Re: Feature request - support for (void)(p)
    ... May this work across all the compilers you use? ... > All other compilers I use (GCC, BCC, Digital Mars) support the ... > notation to suppress pointless warnings resulting from this. ... > It would be great if lcc-win32 could support this feature. ...
    (comp.compilers.lcc)
  • Re: Gnu tools for ARM Cortex development
    ... There are some aspects where top-rank commercial compilers will do a better job - their support for "cpu accelerators" such as extra DSP or vector units is often better, especially if there are few chips with these units. ... In general, the more specialised an add-on is, the less likely it is that gcc will fully support it. ...
    (comp.arch.embedded)