Variable names for cpp

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Variable names for cpp

Dion Whitehead Amago
This variable throw a compiler error:

inline public static var INT32_MIN = 0x80000000;

But this is ok

inline public static var INT32MIN = 0x80000000;

What are the rules about variable names for the cpp target? Is there
some parsing going on, where "INT" may be a bad choice?

Cheers,
Dion

Full error:

In file included from
./src/net/amago/turngame/server/compute/ComputeServer.cpp:7:
include/net/amago/turngame/server/compute/ComputeServer.h:35: error:
expected unqualified-id before ‘-’ token
include/net/amago/turngame/server/compute/ComputeServer.h:35: error:
expected `)' before ‘-’ token
./src/net/amago/turngame/server/compute/ComputeServer.cpp:36: error:
expected unqualified-id before ‘(’ token
./src/net/amago/turngame/server/compute/ComputeServer.cpp: In member
function ‘virtual Dynamic
net::amago::turngame::server::compute::ComputeServer_obj::__SetField(const
String&, const Dynamic&)’:
./src/net/amago/turngame/server/compute/ComputeServer.cpp:78: error:
lvalue required as left operand of assignment
./src/net/amago/turngame/server/compute/ComputeServer.cpp: In function
‘void
net::amago::turngame::server::compute::sMarkStatics(hx::MarkContext*)’:
./src/net/amago/turngame/server/compute/ComputeServer.cpp:97: error:
expected unqualified-id before ‘(’ token
./src/net/amago/turngame/server/compute/ComputeServer.cpp: In static
member function ‘static void
net::amago::turngame::server::compute::ComputeServer_obj::__boot()’:
./src/net/amago/turngame/server/compute/ComputeServer.cpp:111: error:
invalid initialization of non-const reference of type ‘int&’ from a
temporary of type ‘int’
/Users/dion/storage/projects/haxelib/hxcpp/2,07,0//include/hx/GCTemplates.h:46:
error: in passing argument 1 of ‘T& hx::Static(T&) [with T = int]’

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Variable names for cpp

Gamehaxe
Hi,
My guess is that there is a "#define INT32_MIN" somewhere in the header  
files.
I have code for renaming most keywords/defines, but I'm not sure if this
one is standard.  It may be easier to rename the variable :)

Hugh

> This variable throw a compiler error:
>
> inline public static var INT32_MIN = 0x80000000;
>
> But this is ok
>
> inline public static var INT32MIN = 0x80000000;
>
> What are the rules about variable names for the cpp target? Is there  
> some parsing going on, where "INT" may be a bad choice?
>
> Cheers,
> Dion
>
> Full error:
>
> In file included from  
> ./src/net/amago/turngame/server/compute/ComputeServer.cpp:7:
> include/net/amago/turngame/server/compute/ComputeServer.h:35: error:  
> expected unqualified-id before ‘-’ token
> include/net/amago/turngame/server/compute/ComputeServer.h:35: error:  
> expected `)' before ‘-’ token
> ./src/net/amago/turngame/server/compute/ComputeServer.cpp:36: error:  
> expected unqualified-id before ‘(’ token
> ./src/net/amago/turngame/server/compute/ComputeServer.cpp: In member  
> function ‘virtual Dynamic  
> net::amago::turngame::server::compute::ComputeServer_obj::__SetField(const  
> String&, const Dynamic&)’:
> ./src/net/amago/turngame/server/compute/ComputeServer.cpp:78: error:  
> lvalue required as left operand of assignment
> ./src/net/amago/turngame/server/compute/ComputeServer.cpp: In function  
> ‘void  
> net::amago::turngame::server::compute::sMarkStatics(hx::MarkContext*)’:
> ./src/net/amago/turngame/server/compute/ComputeServer.cpp:97: error:  
> expected unqualified-id before ‘(’ token
> ./src/net/amago/turngame/server/compute/ComputeServer.cpp: In static  
> member function ‘static void  
> net::amago::turngame::server::compute::ComputeServer_obj::__boot()’:
> ./src/net/amago/turngame/server/compute/ComputeServer.cpp:111: error:  
> invalid initialization of non-const reference of type ‘int&’ from a  
> temporary of type ‘int’
> /Users/dion/storage/projects/haxelib/hxcpp/2,07,0//include/hx/GCTemplates.h:46:  
> error: in passing argument 1 of ‘T& hx::Static(T&) [with T = int]’

--
haXe - an open source web programming language
http://haxe.org