FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Bug Fixes, Implemented Suggestions
(Moderator: fry)
   Casting/compiling bug?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Casting/compiling bug?  (Read 309 times)
Jerronimo

WWW
Casting/compiling bug?
« on: Sep 1st, 2003, 4:51am »

If i try to run the following code:
 
========
int x = 10;
int y = 10;
float z= float(x) + float(y);
========
 
I get a "Invalid Name" error.  But the following code works perfectly, with the second "float()" cast on the next line:
 
========
int x = 10;
int y = 10;
float z= float(x) +  
    float(y);
========
 
It does the same thing with int().
 
(this is on Alpha 0058 under OS X)
 
mKoser

WWW Email
Re: Casting/compiling bug?
« Reply #1 on: Sep 1st, 2003, 4:46pm »

Uhh, I get the same on winXP P5_0059.
 
float()
Code:

int x = 10;  
int y = 10;  
float z= float(x) + float(y);  

throws:
"Syntax Error: Unexpected symbol ignored"
 
int()
Code:

int x = 10;  
int y = 10;  
int z= int(x) + int(y);  

throws:
"Syntax Error: Invalid Name"
 
- - - -
 
however!
this works (also with int):
Code:

int x = 10;  
int y = 10;  
float z= (float)x + (float)y;

 
.. I seem to remember some mumble in a corner of this webpage about problems using the P5-native float(x) and int(x) methods, and instead one could avoid problems by using Javas (float)x and (int)x methods!
 
+ mikkel
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
fry


WWW
Re: Casting/compiling bug?
« Reply #2 on: Sep 2nd, 2003, 4:52am »

fixed with dan's new parser for 0060.
 
Pages: 1 

« Previous topic | Next topic »