#21
|
|||
|
|||
Re: C error
[ QUOTE ]
well if you change the && to || it just means if(true) the problem is in here: ((charmode!=M_ASCII) || (charmode!=M_BINARY)) this is always true. A) your name is not fred B) your name is not tom A || B == true for all possible guesses regardless of your name [/ QUOTE ] Not ALWAYS true. M_ASCII and M_BINARY could be eq. values. This would not always result in a true return value. I highly doubt this would ever be the case here since these are #DEFINE'd, but just a small nit. For all intensive purposes, you are correct though and this line of code looks very suspitious. If M_ASCII and M_BINARY were regularly changing variables, then it could be valid, but it does not appear to be so in this case. |
#22
|
|||
|
|||
Re: C error
[ QUOTE ]
[ QUOTE ] the error isn't where you think it is. you'd have to post a whole lot more than this for us to tell you. it's probably something that seems totally unrelated to the error messages. like a missing semi-colon at the end of a line. or something. [/ QUOTE ] i'm thinking "or something". i don't think a missing semi colon will be missed by the compiler [/ QUOTE ] Is this like your first semester? I assure you a missing anything in the wrong place can cause very strange problems. |
#23
|
|||
|
|||
Re: C error
[ QUOTE ]
../userprog/exception.cc: In function `char* UserToSystem(int, int, int)': ../userprog/exception.cc:107: parse error before `)' token ../userprog/exception.cc:107: parse error before `)' token ../userprog/exception.cc:129: parse error before `)' token ../userprog/exception.cc: In function `int SystemToUser(int, int, int, char*)': ../userprog/exception.cc:145: parse error before `)' token ../userprog/exception.cc:145: parse error before `)' token ../userprog/exception.cc:165: parse error before `)' token ../userprog/exception.cc:170: parse error before `)' token oddly enough the line of code is: if((numbytes<0) && ((charmode!=M_ASCII) || (charmode!=M_BINARY))) i doubt i'll get any useful replies but my TA is taking forever so i thought hell i'll give this a whirl. numbytes, charmode is defined in the function declaration and M_ASCII/M_BINARY are #define b4 class starts. [/ QUOTE ] Show us the code, we'll solve it. |
#24
|
|||
|
|||
Re: C error
[ QUOTE ]
../userprog/exception.cc: In function `char* UserToSystem(int, int, int)': ../userprog/exception.cc:107: parse error before `)' token ../userprog/exception.cc:107: parse error before `)' token ../userprog/exception.cc:129: parse error before `)' token ../userprog/exception.cc: In function `int SystemToUser(int, int, int, char*)': ../userprog/exception.cc:145: parse error before `)' token ../userprog/exception.cc:145: parse error before `)' token ../userprog/exception.cc:165: parse error before `)' token ../userprog/exception.cc:170: parse error before `)' token oddly enough the line of code is: if((numbytes<0) && ((charmode!=M_ASCII) || (charmode!=M_BINARY))) i doubt i'll get any useful replies but my TA is taking forever so i thought hell i'll give this a whirl. numbytes, charmode is defined in the function declaration and M_ASCII/M_BINARY are #define b4 class starts. [/ QUOTE ] You need to give us more code, there isn't enough here to see what's going on. Parsing errors are caused by a variety of reasons. |
#25
|
|||
|
|||
Re: C error
[ QUOTE ]
you know looking at it, it's happening only on M_ASCII and M_BINARY my lines for those are #define M_ASCII #define M_BINARY i don't have any values for it. now i gotta figure out what the hell values i should give it. OOT > TA's and professors combined. [/ QUOTE ] If you don't assign values to these after the code is passed through the C preprocessor your code will come out as [ QUOTE ] if((numbytes<0) && ((charmode!=) || (charmode!=))) [/ QUOTE ] which will never compile and is probably responsible for your parsing error unless you are also missing semicolons or braces above this line. You seem to have parsing errors at more than one line, but sometimes there is in fact just one offending line. I don't know what you're doing, but there's possibly a logical error in your code too. cf. basic Boolean logic to make sure what you're doing is what you want. |
#26
|
|||
|
|||
Re: C error
Whatever happened to Basic?
|
#27
|
|||
|
|||
Re: C error
[ QUOTE ]
Whatever happened to Basic? [/ QUOTE ] it went visual |
#28
|
|||
|
|||
Re: C error
Without the complete code my best guess here is messed up #define, probably with a ";" terminating one or something like that.
edit: nvm, didn't read replies. |
#29
|
|||
|
|||
Re: C error
[ QUOTE ]
[ QUOTE ] [ QUOTE ] the error isn't where you think it is. you'd have to post a whole lot more than this for us to tell you. it's probably something that seems totally unrelated to the error messages. like a missing semi-colon at the end of a line. or something. [/ QUOTE ] i'm thinking "or something". i don't think a missing semi colon will be missed by the compiler [/ QUOTE ] Is this like your first semester? I assure you a missing anything in the wrong place can cause very strange problems. [/ QUOTE ] Like, oh my god! |
|
|