Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/14/05 17:22
Read: times


 
#84991 - Compiler deducing array size
Responding to: ???'s previous message
Now not all compilers will support this I know a MS compiler would.

Which version of VC++ supports this?

I have tried with a couple of the versions we have here, and they do not. The error generated is exactly what I expect:

Y:VC++c99_testtest.c(4) : error C2087: '<Unknown>' : missing subscript
Y:VC++c99_testtest.c(5) : error C2078: too many initializers


But, maybe there is a more recent release of VC++ than what I have here.

After reading the C99 specification, I'm not convinced that initializations of multidimensional arrays with more than one unspecified dimension are addressed.

What does the C99 specification say about the following case?

char key_tbl[][] =
{
    {  1           },    // row 0
    {  2, 3        },    // row 1
    {  4, 5, 6     },    // row 2
    {  7, 8, 9, 10 },    // row 3
};


Clearly, the compiler cannot process the data in sequential order. It must go back and adjust the number of items in each preceeding row for each new row processed. And, I'm not certain that this is addressed. Since this would be a completely new feature of the language, you would think that the C99 specification would include a few examples of such a thing. It doesn't.

So, I tried a few of the examples in the C99 spec from section 6.7.8. They all work as expected in C51 V7.50--even the sparse array initialization examples they have.

As for ANSI compliance, we use the same ANSI test suites that everyone else uses (there are only 2) and the places where we are non-compliant we list in the appendix of each manual. For C51, this is wide character support and the reentrant keyword being required for recursive function calls.

If someone has different information regarding this issue, please post it here or e-mail me directly.

Jon

List of 32 messages in thread
TopicAuthorDate
Philips sample code/Keil problems            01/01/70 00:00      
   Why don't you ask Philips?            01/01/70 00:00      
      Re: Why don't you ask Philips?            01/01/70 00:00      
         Re: Ask Philips?            01/01/70 00:00      
            Re: Ask Philips?            01/01/70 00:00      
               Link            01/01/70 00:00      
                  Re: useful App Note            01/01/70 00:00      
                     87 89            01/01/70 00:00      
                        Re: 87 89            01/01/70 00:00      
               Tasking.            01/01/70 00:00      
                  Re: Tasking            01/01/70 00:00      
                     Keil?            01/01/70 00:00      
                        Re: Keil            01/01/70 00:00      
                           Linking            01/01/70 00:00      
                              Linked!            01/01/70 00:00      
                                 Re: Linked            01/01/70 00:00      
                                    Linking            01/01/70 00:00      
                  Re: Tasking            01/01/70 00:00      
         reply            01/01/70 00:00      
   Dunfields or Tasking?            01/01/70 00:00      
      Tasking            01/01/70 00:00      
   2D Array problem            01/01/70 00:00      
      Compiler can deduce size.            01/01/70 00:00      
         can, but doesn't have to!            01/01/70 00:00      
            Fully Bracketed Initializers            01/01/70 00:00      
               Ask Keil            01/01/70 00:00      
               C99 vs. C90            01/01/70 00:00      
         Compiler deducing array size            01/01/70 00:00      
            Tasking Compiler deduces array size!            01/01/70 00:00      
               Which Array?            01/01/70 00:00      
                  That Array!            01/01/70 00:00      
                     One More Test            01/01/70 00:00      

Back to Subject List