delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/29/13:13:02

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Weird : Segmentation fault on fwrite :(
Date: Sat, 29 Apr 2000 17:39:21 GMT
Organization: always disorganized
Lines: 27
Message-ID: <390b1e3a.121033826@news.freeserve.net>
References: <956963090 DOT 719428 AT romulus DOT infonie DOT fr> <957001855 DOT 943830 AT romulus DOT infonie DOT fr> <8eef1d$ai7$1 AT plato DOT wadham DOT ox DOT ac DOT uk> <390adf87 DOT 104978688 AT news DOT freeserve DOT net> <8eesmi$c8g$1 AT plato DOT wadham DOT ox DOT ac DOT uk>
NNTP-Posting-Host: modem-139.new-mexico.dialup.pol.co.uk
X-Trace: newsg4.svr.pol.co.uk 957029962 14407 62.137.82.139 (29 Apr 2000 17:39:22 GMT)
NNTP-Posting-Date: 29 Apr 2000 17:39:22 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

J-P wrote:

>Ah. This is the relevant bit from K&R.

After some searching I finally found another relevant bit, in
section A7.1:

    If the type of an expression or subexpression is "array of T,"
    for some type T, then the value of the expression is a pointer 
    to the first object in the array, and the type of the expression
    is altered to "pointer to T."  This conversion does not take
    place if the expression is the operand of the unary & operator,
    or of ++, --, sizeof, or as the left operand of an assignment
    operator or the . operator.

This, then, lists the exceptions to the implicit conversion to a 
pointer, although it doesn't say what happens in these exceptional
cases.  What happens is this:

    &arrayname          Gives a pointer to an array of T.
    arrayname++         Invalid.
    arrayname--         Invalid.
    sizeof arrayname    Gives the size of the array.
    arrayname = foo     Invalid.
    arrayname.foo       Invalid.

S.

- Raw text -


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