Skip to content

Compatibility of external C code across platforms

4 messages · Murray Efford, Brian Ripley, William Dunlap

#
On Sat, 26 Sep 2009, Murray Efford wrote:

            
Yes, it is essential.  R does not assume gcc, and it does not even 
assume gcc 4.x (and people are still using gcc 3.x on some platforms, 
e.g. the sunfreeware R builds).  This is why we publish test result on 
CRAN for a completely different compiler (from SunPro).

However, if is not clear which standard you mean by 'ISO C': assuming 
C99 is fairly safe, but GNU extensions from C99 are not -- nested 
functions are one such.
Well, you (and only you) can easily check that for yourself, but the 
other flags also matter, especially --std.  Because it has been needed 
for the use of the MinGW headers, R on Windows is built with 
--std=gnu99.  (Linux headers have a similar problem: using --std=c99 
disables some features we test for in configure and wish to use -- and 
there are OS features, not language extensions.)
Please note what the posting guide has to say about that.

  
    
#
Thank you. I'm much clearer on this. I now notice that the messages from gcc distinguish breaches of ISO C and ISO C90, and can see the significance.  My gcc versions were the same - the different behaviour is likely to be explained by the --std flag. And it looks like I have to re-write a lot of C to eliminate nesting of functions.  Point taken about HTML.
Murray Efford