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-19 19:43

>>17
ostringstream and endl are both in namespace std.  this is normal behaviour in pretty much any C++ compiler you're likely to use.  you want to either tack a "using namespace std;" somewhere so the compiler knows which namespace to look in, or explicitly call std::ostringstream and std::endl each time you use them.

in other words, MSVC++6.0 may suck, but not for this reason.

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