C++ name with leading underscore character not Compiling

Eric Lilja mindcooler@gmail.com
Mon Apr 16 12:58:00 GMT 2007


Chelton Evans skrev:
> Thanks for the language correction. However the compiler is braking.
> Here is some of the code and the error messages reported in compilation.
> 
> I have tested this on two different computers and the same error 
> messages were
> reported.  When I changed the _N to N or something else the
> compilation continued
> on to the next error. Hence it is an underscore problem.
> 
> g++ -Wall -I. -I../misclib/ -I../graphicslib/ -I../mathlib/  -c
> ../graphicslib/graphmisc.cpp
> In file included from ../graphicslib/graphmisc.cpp:3:
> ../graphicslib/graphmisc.h:561: error: expected `,' or `...' before
> numeric constant
> ../graphicslib/graphmisc.h:570: error: expected `,' or `...' before
> numeric constant
> ../graphicslib/graphmisc.h:574: error: expected `,' or `...' before
> numeric constant
> ../graphicslib/graphmisc.cpp:232: error: expected `,' or `...' before
> numeric constant
> ../graphicslib/graphmisc.cpp:256: error: expected `,' or `...' before
> numeric constant
> ../graphicslib/graphmisc.cpp: In constructor
> `gobjMyCircle::gobjMyCircle(doublec, doublec, doublec, uintc)':
> ../graphicslib/graphmisc.cpp:258: error: default argument missing for
> parameter 4 of `gobjMyCircle::gobjMyCircle(doublec, doublec, doublec,
> uintc)'
> ../graphicslib/graphmisc.cpp: At global scope:
> ../graphicslib/graphmisc.cpp:299: error: expected `,' or `...' before
> numeric constant
> make: *** [graphmisc.o] Error 1
> 
> 
> 
> /*!
> \brief Sampled circle or ellipse.
> 
> This can be used in drawing circles of different sizes
> by gobjMyCircleDraw .
> */
> class gobjMyCircle : public gobj
> {
> public:
> 
>  /** The number of sampled points. */
>  uintc N;
> 
>  /** The samples x values. */
>  float * const ptx;
>  /** The samples y values. */
>  float * const pty;
> 
>  /** General arcs can be created by changing the angle
>     interval [theta0,theta1].  Ellipses can be made
>     by changing the axis lengths.
>   */
>  gobjMyCircle
>  (
>    doublec theta0,
>    doublec theta1,
>    doublec xaxislength,
>    doublec yaxislength,
>    uintc _N=360
>  );
> 
>  /** Create an arc. */
>  gobjMyCircle
>  (
>    doublec theta0,
>    doublec theta1,
>    doublec radius=1.0,
>    uintc _N=360
>  );
> 
> Thanks for your response, I will think twice before using an
> underscore, even though
> I do no agree with it being reserved. It is very important to have
> programs that
> compile across other platforms.

And since you think this is important (and I agree), why on earth are 
you trying to use reservered names that will not benefit this 
portability which you seek? :P

> 
> Chelton Evans
> 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list