On 2011-09-12 21:47+0100 Andrew Ross wrote:

> The gcc manual seems to explain why this happens
> http://gcc.gnu.org/onlinedocs/cpp/Object_002dlike-Macros.html#Object_002dlike-Macros
> It works because all the occurences in oct-dlldefs.h are macros.

Hi Andrew:

I have been exploring the question of whether this behaviour is a gcc
idiosyncrasy or standard behaviour on my local LUG list, and someone
there came up with the following reference:

> Try going to http://gcc.gnu.org/c99status.html and clicking on link
to N1256 to a pdf file is the closest thing I have.

That context is important because that PDF doesn't really identify
itself as c99 or a working draft of that standard.  Anyhow, I assume
it is a c99 working draft.

I did find example 3 "to illustrate the rules or redefinition and
reexamination" in section 6.10.3.5 of that document.  That example
shows a function-like macro that uses another object-like macro which
is subsequently redefined, and that subsequent redefinition appears to
prevail just like you have discovered in the present octave case.  (I
say "appears" here because I cannot seem to find a clear list of the
redefinition rules in that rather opaque document.) So it appears the
gcc preprocessor behaviour clearly documentated at
http://gcc.gnu.org/onlinedocs/cpp/Object_002dlike-Macros.html#Object_002dlike-Macros
is a c99 standard or at least consistent with a draft of that
standard.  Anyhow, that example in the PDF should reduce some of our concerns 
over
using that same trick for dealing with gcc visibility issues with
octave.

> My approach was to make minimal interference, but I agree it is probably
> better to be consistent with pldll.h.

OK, "minimal interference" is also a good argument so I will be happy
with whatever you ultimately decide to do here.

I first really got involved with PLplot in 2000 with very little C
knowledge at the time, and the C knowledge I have accumulated
since then has been mostly self-taught. In my wildest dreams back
then, I never would have thought that 11 years later I would be doing
such exotic stuff as trying to figure out C preprocessor issues by
consulting the standards!  That's a perfect illustration of one of the
advantages of joining free software development efforts such as PLplot
--- You sure learn a lot.

Best wishes,

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry® mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry® DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to