🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sgi.apps
Article #78

Re: CC problem: passing/receiving values to functions

#78
From: Tanmoy Bhattacharya
Date: Wed, 01 Nov 1995 23:04
68 lines
3310 bytes
In article <478q02$d1o@news.wesleyan.edu>, eric@detritus (Eric Buddington)
writes: 
|> System: IRIX 5.3 on Indy, using SGI's CC and dbx
|> 
|> I compiled a program written in ANSI C using CC -g -cckr -fullwarn.
|> Most function calls work properly, but two have given me 
|> nexplainable errors:

Please post _complete_ short examples of your code: I would hazard a guess
that none of us try to debug a C code before looking at the source. Trying to
follow the ret of your post is an absolute waste of time.

(It is possible that the sgi compiler has a bug: in which case somebody will
recognize the symptoms. But, if that is what you are hoping for, why
crosspost to comp.lang.c????)

<snip>
|> This is the call about to be executed:
|> >112  read_dem_record(record[0], 1, 1, dem_ascii);
|> 
|> Here are the values that *should* be passed:
|> >(dbx) print record[1], 1, 1, dem_ascii 
|> >0x100354d8 1 1 0xfb52914 

I do not see why you thought 0 == 1. With logic like that, it is not
surprising that your code does not work ...

(Okay, okay, I am irritated because you expect us to be mind readers. But the
point is that if you are sending a post all over the world: please be very
careful about what you write!!!)

<snip>
|> **In trying to replicate this once more to be certain, it passed the values
|> correctly.**

Looks like you have uncovered an heisenbug :-) (`You cannot simultaneously
look for a bug and find it')

Seriously, this is usually a sign of memory corruption somewhere: try to
compile your program with all warnings turned on, _and_ do not ignore any
warning (You did not say whether there were any warnings). Check every memory
allocation and pointer use: it is impossible to say what the problem is from
what you have described.

|> 
|> -----------------------------------------------------------------------
|> Second: A function returns values, but they aren't assigned as the program
|> specifies.
|> Again, dbx lines are quoted.

Which are almost completely useless without more information. For all I know
you may not have declared G_northing_to_row, or misdeclared it. 

<snip>
|> This has me (and a professor) completely stumped. If you have any answers
|> or suggestions, please email me at ebuddington@wesleyan.edu.

As these are not answers nor concrete suggestions, I am not emailing them.

Cheers
Tanmoy
-- 
tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
<http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
Technical Details
Message-ID: <478udk$8oi@newshost.lanl.gov>
Path: arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoy
References: <478q02$d1o@news.wesleyan.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoy
From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
Newsgroups: comp.sys.sgi.apps,comp.lang.c
Subject: Re: CC problem: passing/receiving values to functions
Date: 1 Nov 1995 23:04:20 GMT
Organization: Los Alamos National Laboratory
Distribution: world
Message-ID: <478udk$8oi@newshost.lanl.gov>
References: <478q02$d1o@news.wesleyan.edu>
NNTP-Posting-Host: qcd.lanl.gov
Keywords: ANSI C,CC,dbx