[Bug 18] New: int foo[0] accept -- what's its semantics?

Stewart Gordon smjg_1998 at yahoo.com
Mon Mar 6 06:14:55 PST 2006


Chris Miller wrote:
>> void main() {
>>     int foo[0];
>> }
>>
>> dmd 0.148 accepts this gdc 0.17 and my 0.18 work in progress both 
>> segv off in gcc land where it's assumed that variables passed into 
>> the middle end all have space associated with them. What are the
>> right semantics for this situation?
> 
> I'd like it to be allowed and completely disable bounds checking on that 
> array, so that the old C trick can work: putting an array as the last 
> field in a struct so that extra memory can be allocated after the struct 
> to add more elements to the array at runtime.
<snip>

Is this to support a legacy API, or what?

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:- C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d-bugs mailing list