Article View: comp.std.c++
Article #2911Re: Array Initialization
From: E. Schweitz
Date: Sat, 09 Dec 1995 01:22
Date: Sat, 09 Dec 1995 01:22
31 lines
1768 bytes
1768 bytes
In article <49lidc$bjc@natasha.rmii.com>, Jerry Coffin <jcoffin@rmii.com> wrote: >fjh@munta.cs.mu.OZ.AU (Fergus Henderson) wrote: >>>IMHO the most important reason to disallow RT-sized arrays >>>is that then sizeof also becomes a RT-size. > >>A fair point -- but would that really cause any problems? > >Unless I'm missing something, a run-time version of sizeof would likely >have to evaluate its argument, so you'd basically end up with two >different sizeof's - one that happened at compile time, didn't evaluate >its argument and allowed use of expressions that can't be evaluated >legally. While the essence here is true, I don't think it is a real problem. The compiler must be able to detect a variable of type dynamic array (as I'm late to this discussion, I am assuming dynamic arrays are arrays allocated on the stack of variable size) and thus infer that it must compute the sizeof said array at run-time. Which basically, it has to do anyway under these assumptions. -- Eric --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<4aa2sj$oke@aurns1.aur.alcatel.com>Path:
arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!MattReferences:
<496gnn$hdh@treflan.shout.net> <49felu$68m@sunsystem5.informatik.tu-muenchen.de> <9533411.19718@mulga.cs.mu.OZ.AU> <49lidc$bjc@natasha.rmii.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!agate!agate!Matt From: schwea@aur.alcatel.com (E. Schweitz) Newsgroups: comp.std.c++ Subject: Re: Array Initialization Date: 09 Dec 1995 01:22:25 GMT Organization: Alcatel Network Systems, Inc., Raleigh, NC Approved: Matt@Austern Message-ID: <4aa2sj$oke@aurns1.aur.alcatel.com> References: <496gnn$hdh@treflan.shout.net> <49felu$68m@sunsystem5.informatik.tu-muenchen.de> <9533411.19718@mulga.cs.mu.OZ.AU> <49lidc$bjc@natasha.rmii.com> NNTP-Posting-Host: austern.hip.berkeley.edu