🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CC problem: passing/receiving values to functions

#79
From: Paul Tomblin
Date: Thu, 02 Nov 1995 18:10
56 lines
2819 bytes
In a previous article, eric@detritus (Eric Buddington) said:
                       ^^^^^^^^^^^^^
By the way, your news software is badly configured and your return address is
invalid.

:
: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 

Why are you passing record[0] and printing record[1]?  If you want to pass the
address of the array, don't pass the *value* of the first element.  If you are
doing what I think you are doing, I think you need to change the call to
read_dem_record(record, 1, 1, dem_ascii);

:This is the call about to be executed:
:>  85  cell_row[0] = G_northing_to_row(north, cell_head);
:
:Again, the values that should be passed:
:>(dbx) print north, cell_head
:>4540683.5292848777 0x7fffad48 
:
:This time, they are passed correctly, and the function returns 1441.0:
:>(dbx) S
:>[14] calling G_northing_to_row(north = 4540683.5292848777,
:>   window = 0x7fffad48) from function conv_row_ll2u
:>Process 25208 (r.in.dem) stopped at [G_northing_to_row:123 ,0x40d9c4]
:> 123  return (window->north - north) / window->ns_res;
:>(dbx) S
:>[14] G_northing_to_row returning 1441.0 from G_northing_to_row
:>Process 25208 (r.in.dem) stopped  [conv_row_ll2u:85 +0x18,0x405b80]
:>  85  cell_row[0] = G_northing_to_row(north, cell_head);
:
:But now the assignment goofs:
:(dbx) S
:>[13] cell_row[0] changed before [conv_row_ll2u: line 85]:
:>                new value = 1.0;
:>Process 25208 (r.in.dem) stopped on watchpoint writing address
:>  0x7fffacd4 [conv_row_ll2u:85 +0x2c,0x405b94]

For this one, I'd suggest you've got your prototypes and declarations screwed
up.  Do you have ansi style prototypes?  If so, is the prototype in scope when
you call the function, and is the function defined with a new style
declaration?  If not, have you properly defined the return type of the
function in the scope where you call it, and have you taken into account type
promotion in old-style argument passing?


-- 
Paul Tomblin, Contract Programmer.
I don't speak for Kodak, they don't speak for me.
(Email that is not work related should go to: ptomblin@canoe.com)
"You are in a twisty maze of Motif Widget resources, all inconsistent."
Technical Details
Message-ID: <47b1iq$9oj@apollo.ekfido.kodak.com>
Path: arc1-ca.pugleaf.net!apollo.ekfido.kodak.com!not-for-mail
References: <478q02$d1o@news.wesleyan.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!apollo.ekfido.kodak.com!not-for-mail
From: tomblin@ekfido.kodak.com (Paul Tomblin)
Newsgroups: comp.sys.sgi.apps,comp.lang.c
Subject: Re: CC problem: passing/receiving values to functions
Date: 2 Nov 1995 13:10:34 -0500
Organization: Tomblin Computer Consulting, Rochester, New York and Ottawa, Ontario
Message-ID: <47b1iq$9oj@apollo.ekfido.kodak.com>
References: <478q02$d1o@news.wesleyan.edu>
NNTP-Posting-Host: apollo.ekfido.kodak.com