IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Parker on November 17, 2005, 04:55:08 PM

Title: Can I cast without dereferencing?
Post by: Parker on November 17, 2005, 04:55:08 PM
When I try to use the following code
value += (int)str[i];
it gives me a "Syntax error - int". I know that this conversion is done automatically, but in some other cases it is necessary to do this. I've tried the operators **, #, ##, and just (typename), but none seem to work. Is there something I'm missing, or is it not implemented yet?
Title: Re: Can I cast without dereferencing?
Post by: Ionic Wind Support Team on November 18, 2005, 06:08:21 PM
Give me a case where automatic conversion doesn't cut it and I'll make it work ;)

Paul.
Title: Re: Can I cast without dereferencing?
Post by: Parker on November 19, 2005, 12:58:58 PM
If I'm calling a function with variable arguments and I want it to cast a BYTE to an INT before calling, the compiler won't know that. I haven't needed it yet, but maybe someday. It also makes code easier to read, I think.
Title: Re: Can I cast without dereferencing?
Post by: Ionic Wind Support Team on November 19, 2005, 02:21:25 PM
Anything less than 32 bits is sent as an INT on the stack.  So when you pass a byte it still takes up 32 bits anyway.

Paul.
Title: Re: Can I cast without dereferencing?
Post by: Parker on December 11, 2005, 01:57:23 PM
How about this:
m_pFile = new(byte, GetFileLength(file)+1);
I get an integer value expected error.

I realize this can be fixed with automatic casting though.