![]() |
| ||
| Is this legal? If I declare a struct node, is the following legal in C++? node nodes_array[vector.size()]; I know this is not legal in C. However, my C++ compiler does not complain. Is this only in recent versions of C++, or has this always been legal in C++? |
| ||
| Re: Is this legal? Depends on the compiler -- most c++ compilers will complain about that. |
| ||
| Re: Is this legal? In C99, the latest C standard, that would be legal. (Well, not the "vector.size()", but the runtime initialization of the array size.) You can use scoped_array<node> nodes_array(new node[vector.size()]); instead -- if you have the boost libraries installed. |
| All times are GMT -4. The time now is 12:54 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC