[aspectc-user] Bug or feature?

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Tue Mar 30 10:24:08 CEST 2004


Thiago A. CorrĂȘa wrote:
> Hi,
>    I was trying to use the trace.ah in an opengl program and found that the
> weaver complains whenever it finds the word "aspect" anywhere in the
> code.... first inside glu.h:
> void APIENTRY gluPerspective (
> GLdouble fovy,
> GLdouble aspect,
> GLdouble zNear,
> GLdouble zFar);
> Then, if you do something like:
> class Camera
> {
> double aspect;
> };
> So, is "aspect" a reserved word even outside an .ah file?

yes. The "ah" is only needed to include the aspect definition 
automatically and transparently into the translation units.

> Best Regards,
>     Thiago A. CorrĂȘa

This is neither a bug nor a feature, but a problem anyway. AspectC++ is 
a language extension. "aspect" is a keyword as, for instance, "class". 
If you use "class" as an identifier in a C (not C++) program you will 
also get error messages.

I am aware that being consequent at this point leads to problems with 
C++ code that you want include in your AspectC++ application. However, 
possible workarounds are always a kind of "hack" like having a context 
dependend scanner or implementing some grammar tricks. Therefore, we 
don't provide a solution yet.

We will discuss possible solutions for this problem and implement them 
sooner or later. However, this has to be done with a lot of care as it 
will no be possible to define aspects in files or scopes where "aspect" 
is regarded as a normal identifier.

For now you can only help yourself by something like this in your 
application (just an idea):

#ifdef __puma // only set when ac++ parses your code
#define aspect GL_aspect
#include ... some GL headers
#undef aspect

If you use "aspect" as an identifier in your function bodies, put a 
similar ifdef around.

Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3142 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20040330/7245420c/attachment.bin>

More information about the aspectc-user mailing list