MESSAGE
DATE | 2002-04-24 |
FROM | Ruben I Safir
|
SUBJECT | Re: [hangout] C problem
|
This is realy strange. On SCO, any return value less than or equal to zero is a false.
Ruben
On 2002.04.24 13:27 Jon Bober wrote: > > The value -1 results in "true." The only value that results in "false" > is 0. > > The C statement: > if(x) > > is something similar to the assembler statement > cmp 0, x > > Basically, if(x) means if(x!=0) > > > On Wed, Apr 24, 2002 at 09:59:29AM -0400, Ruben I Safir wrote: > > > > Yes > > > > That's right, but it still doesn't work and I'm not > > sure why. When you send CTL D the scanf returns a -1, which I asume is the > > EOF result, and the if statement doesn't break. > > > > > > This is why I use Perl > > > > > > Ruben > > > > > Wow. I feel really stupid. I don't know how that happened. I guess I > > > was looking at the warnings. > > > > > > I think that the problem is one of operator precedence. try: > > > if (!(ret=scanf("%255s", buff_key))) > > > > > > I just tested the two lines > > > z = (!y=x); > > > > > > and > > > z = (!(y=x)); > > > > > > The latter works but not the former. The first is trying to assign the > > > value x to !y > > > > > > On Wed, 24 Apr 2002 01:20:19 -0400 (EDT) > > > Ruben I Safir wrote: > > > > > > > > > > > > First, what is g_hash_table_new(), if those warnings are important > > > > > to you? > > > > > > > > > > > > > ITs a gtk function which has nothing to do with the problem > > > > > > > > > > > > > Second, hTable must be declared > > > > > > > > > > > > Yahah yadah - it's declared above main where it belongs > > > > > > > > The error is the lvalue > > > > int ret and scanf > > > > > > > > THIS is the line which is the problem > > > > > > > > > > if(! ret=scanf("%255s", buff_key)) break; <====LINE 35 > > > > > > hash.c:35: invalid > > > > > > lvalue in assignment > > > > > > > > > > > > -- > > > > > > __________________________ > > > > > > > > > > > > Brooklyn Linux Solutions > > > > > > __________________________ > > > > > > http://www.mrbrklyn.com - Consulting > > > > > > http://www.brooklynonline.com - For the love of Brooklyn > > > > > > http://www.nylxs.com - Leadership Development in Free Software > > > > > > http://www.nyfairuse.org - The foundation of Democracy > > > > > > http://www2.mrbrklyn.com/resources - Unpublished Archive or > > > > > > stories and articles from around the net > > > > > > http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I > > > > > > saw you... http://www2.mrbrklyn.com/downtown.html - See the New > > > > > > Downtown Brooklyn.... > > > > > > > > > > > > 1-718-382-5752 > > > > > > > > > > > > > > > > > > > > > > > > ____________________________ > > > > > > New Yorker Linux Users Scene > > > > > > Fair Use - > > > > > > because it's either fair use or useless.... > > > > > > > > > > > > > ____________________________ > > > > New Yorker Linux Users Scene > > > > Fair Use - > > > > because it's either fair use or useless.... > > > > > > > ____________________________ > > New Yorker Linux Users Scene > > Fair Use - > > because it's either fair use or useless.... > ____________________________ > New Yorker Linux Users Scene > Fair Use - > because it's either fair use or useless.... > -- __________________________
Brooklyn Linux Solutions __________________________ http://www.mrbrklyn.com - Consulting http://www.brooklynonline.com - For the love of Brooklyn http://www.nylxs.com - Leadership Development in Free Software http://www.nyfairuse.org - The foundation of Democracy http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from around the net http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you... http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn....
1-718-382-5752
____________________________ New Yorker Linux Users Scene Fair Use - because it's either fair use or useless....
|
|