DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER

Die hier archivierte Mail kann, muss sich aber nicht auf den Themenkomplex von Oekonux beziehen.

Insbesondere kann nicht geschlossen werden, dass die hier geäußerten Inhalte etwas mit dem Projekt Oekonux oder irgendeiner TeilnehmerIn zu tun haben.

DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER

Message 01769 [Homepage] [Navigation]
Thread: choxT01763 Message: 3/3 L2 [In date index] [In thread index]
[First in Thread] [Last in Thread] [Date Next] [Date Prev]
[Next in Thread] [Prev in Thread] [Next Thread] [Prev Thread]

Re: [chox] GCC vs. C-Standard



* Stefan Merten <smerten oekonux.de> [2006-06-27 18:22]:
Yesterday Holger Weiss wrote:
| The two editions of the C standard provide almost 100% of the details
| needed to implement a conforming processor of C programs. In contrast
| gcc and other compilers typically document their extensions from the
| users' side ("this is how you can use our new cool feature"), and rarely
| provide enough details for developing a fully compatible implementation.

What about the source code?

His point was that source code is usually much more likely to change
than documented semantics, "such undocumented behavior can change any
day" (http://www.spinellis.gr/blog/20060625/).  And yes, the semantics
of GCC-specific features _did_ change in incompatible ways in the past.

| Thus we have open source software limiting interoperability by embracing
| and extending existing standards. [...]
|
| It would be great if we, implementers of open source software, showed
| some temperance in our work and implemented the whole standard and
| (almost) nothing outside the standard. Only then can we honestly claim
| to be really supporting open standards and interoperability.

[ http://www.spinellis.gr/blog/20060625/ ]

Well, seems like someone doesn't know well what s/he speaks of. From
`man gcc`:

       Options Controlling C Dialect

       The following options control the dialect of C (or lan­
       guages derived from C, such as C++ and Objective-C) that
       the compiler accepts:

       -ansi
           In C mode, support all ISO C90 programs.  In C++ mode,
           remove GNU extensions that conflict with ISO C++.  [...]

I have no doubt Spinellis is aware of these GCC flags.  For example, the
following non-ANSI code compiles fine with "-ansi":

  /* gcc -ansi -o gnuprint gnuprint.c */
  #include <stdio.h>
  #define gnuprint(fmt, args...) printf(fmt , ##args)
  int main(void) { gnuprint("%s, %s!\n", "hello", "world"); return 0; }

BTW, it wouldn't compile with non-recent GCC releases (which support the
same feature using a slightly different syntax), _if_ I wouldn't have
inserted a space prior to the comma[1].  Recent GCC releases will spit
out a warning if you specify "-ansi -pedantic", though.

The code Spinellis quotes in his blog entry gives another example.

Frankly this looks to me quite differently. It gives the user full
control whether s/he want to allow extensions or not. I wonder whether
there are such switches for instance in the Java implementation of M$.

No idea, but all (proprietary) C compilers I use (including Microsofts
CL.EXE[2]) support such switches, so that's pretty common.  Of course,
it's just as common to provide proprietary extensions (by default) like
GCC does.  Unlike Spinellis, I'd usually blame the GCC users for _using_
those extensions (without making sure the code will also compile with
other compilers), rather than the GCC developers for providing them.

However, no matter who you blame, it's just hopeless idealism ;-)  In a
(UNIX) world dominated by GCC/Linux/x86, it's inevitable that people
compiling code on other platforms will run into trouble, just as it's
inevitable that people using browsers other than IE will sometimes run
into trouble browsing the net.  However, this _is_ annoying for those
people, and IMHO it's okay to gripe about (relying upon) non-standard
behaviour every now and then on arbitrary Chat-Lists ;-)

Holger

[1] http://gcc.gnu.org/onlinedocs/gcc-4.1.1/cpp/Variadic-Macros.html
    http://gcc.gnu.org/onlinedocs/gcc-4.1.1/cpp/Differences-from-previous-versions.html
[2] http://msdn.microsoft.com/en-us/library//0k0w269d.aspx

PS: While I'm at it, for those who speak C, another nice GCC bashing
    from the same blog: http://www.spinellis.gr/blog/20050717/ :-)

-- 
PGP fingerprint:  F1F0 9071 8084 A426 DD59  9839 59D3 F3A1 B8B5 D3DE
_______________________
Web-Site: http://www.oekonux.de/
Organization: http://www.oekonux.de/projekt/
Contact: projekt oekonux.de



[English translation]
Thread: choxT01763 Message: 3/3 L2 [In date index] [In thread index]
Message 01769 [Homepage] [Navigation]