Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > 2+2 Communities > Other Other Topics
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 10-03-2005, 08:13 PM
bravos1 bravos1 is offline
Senior Member
 
Join Date: Jun 2005
Location: In too deep
Posts: 323
Default 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.
Reply With Quote
  #22  
Old 10-03-2005, 11:32 PM
Sifmole Sifmole is offline
Junior Member
 
Join Date: Feb 2004
Posts: 0
Default 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.
Reply With Quote
  #23  
Old 10-03-2005, 11:33 PM
Sifmole Sifmole is offline
Junior Member
 
Join Date: Feb 2004
Posts: 0
Default 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.
Reply With Quote
  #24  
Old 10-03-2005, 11:36 PM
jason_t jason_t is offline
Senior Member
 
Join Date: Nov 2004
Location: Another downswing?
Posts: 2,274
Default 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.
Reply With Quote
  #25  
Old 10-03-2005, 11:37 PM
jason_t jason_t is offline
Senior Member
 
Join Date: Nov 2004
Location: Another downswing?
Posts: 2,274
Default 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.
Reply With Quote
  #26  
Old 10-03-2005, 11:37 PM
Guest
 
Posts: n/a
Default Re: C error

Whatever happened to Basic?
Reply With Quote
  #27  
Old 10-03-2005, 11:58 PM
MonkeeMan MonkeeMan is offline
Junior Member
 
Join Date: Mar 2004
Location: Austin
Posts: 0
Default Re: C error

[ QUOTE ]
Whatever happened to Basic?

[/ QUOTE ]

it went visual
Reply With Quote
  #28  
Old 10-04-2005, 12:00 AM
DrSavage DrSavage is offline
Senior Member
 
Join Date: Jul 2003
Location: Brooklyn
Posts: 634
Default 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.
Reply With Quote
  #29  
Old 10-04-2005, 12:37 PM
meleader2 meleader2 is offline
Senior Member
 
Join Date: Apr 2005
Location: Women are truly -EV
Posts: 320
Default 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!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.