www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/02/09:59:32

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Weird : Segmentation fault on fwrite :(
Date: 2 May 2000 13:53:43 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 18
Message-ID: <8emml7$as9$1@nets3.rz.RWTH-Aachen.DE>
References: <956963090 DOT 719428 AT romulus DOT infonie DOT fr> <20000429101940 DOT A22474 AT chance DOT cz> <957001855 DOT 943830 AT romulus DOT infonie DOT fr>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 957275623 11145 137.226.32.75 (2 May 2000 13:53:43 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 2 May 2000 13:53:43 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

HPMAN <mwa DOT p AT infonie DOT fr> wrote:
> Isn't the '&' supposed to be implicit with arrays ?

No. It's somewhat close to that, but not really the same thing.  The
'&' is implicit *if* the array variable's name is used 'in a pointer
context'. You may have to read all of K&R2 or the ANSI C standard document
to fully understand what that phrase means, exactly.

> Why does it work in a program and not in another one ???

Because that other program most likely has a bug elsewhere. Just because
it's fwrite() that triggers the crash doesn't mean it has anything to
do with its real reason. Most probably your code wrote outside the bounds
of allocated storage, damaging the FILE* contents or malloc()'s internal
book-keeping data.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019