Skip to main content
gamedev.net
🔒 Locked

error

Started by daniel_i_l Dec 12, 2005 at 12:17 PM 5 replies 500+ views
Original Post
daniel_i_l
daniel_i_l
When I run the following line of code:

char *pMem = new char[ m_MaxElements * sizeof FSA_ELEMENT ];

I get the error - parse error before ';' token. does anyone know what the problem is? Thanks.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
acraig
acraig
Missing () on sizeof?

sizeof(FSA_ELEMENT)
daniel_i_l
daniel_i_l
Thanks guys, your great!
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
Enigma
Enigma
Looks like the kind of situation where a std::vector may be safer (deallocation on all execution paths), easier (management of size/capacity) and potentially more space efficient. Of course, there may be reasons why you're not using one, but it doesn't hurt to mention it.

Enigma
JohnBolton
JohnBolton
BTW, parentheses are needed only if FSA_ELEMENT is a type. This works:
    int x;    size_t y = sizeof x; 
Despite that, I always use parentheses just to avoid confusion.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.