Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

WTF, is this code not valid?

Name: Anonymous 2006-06-18 2:48

void add_speed_direction (short direction, short addspeed, short& xspeed, short& yspeed) {
    /*This function adds the desired speed to the speed of the entity that calls it, in
    the direction it wants. This function should acquire its variables from the function
    that calls it.  I hope     this is a legal operation within methods.  Maybe it'll be
    easier to make it a method itself? */
    xspeed* += (addspeed*sin(direction));
    yspeed* += (addspeed*cos(direction));
}

For some reason, it doesn't like my pointers and indirection operators.  Microsoft Visual C++ 6.0 gives me this error when I go to compile it:
e:\docs\projects\space story\space story.h(124) : error C2059: syntax error : '+='
e:\docs\projects\space story\space story.h(125) : error C2059: syntax error : '+='

Name: Anonymous 2006-06-20 11:42

>>27
Literally speaking, *everything* gets replaced with 0's and 1's when you work with computers, but that's besides the point.  MSVC++ giving you "undeclared identifier" errors is its way of telling you "??? Dude, WTF *is* this shit?"  It doesn't know what "null" or "endl" or whatever means unless you tell it beforehand what it means.  That is the whole point of #include and namespaces.

Namespaces, for the most part, are not mutually exclusive.  If two namespaces do not overlap (do not both define the same thing in different ways), you can use both with no problems.  Even if they DO overlap, you will not get errors unless you use a overlapping identifier without telling the compiler which version to use.  The reason your program compiles on MSVC++6 and nothing else might be because it's adding or assuming a "using namespace std;" without telling you its doing so.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List