Daniel Berlin <[EMAIL PROTECTED]> writes:

| > | 
| > |   Do you suppose the idiom is common enough that VRP could special-case
| > | "arrays of size 1 at the end of a struct" ?
| > 
| > it could be array of size 2, 3, 4, 5, ...
| 
| Except that anything but array of size 1 is not "such a C idomatic
| construct than I would not have expected any "optimizer" to break it."

Well, I've certainly come across many implementation of array like
structures using the aboce trick.  
Consider the following

    struct string_base {
        int size;
        char data[1];
    };

in that structure (assuming an int is 4-byte wide), there are still
room for 3 more char.  So it was written

    struct string_base {
       int size;
       char data[sizeof(int)];
    };

To take advantage of the full sizeof(string_base).  In fact, some
libraries use numbers like 16 of 32 instead of sizeof(int).  Some of
them are even used for the implementation of C++ codes. 

-- Gaby

Reply via email to