| | |
Is this legal?
Thread Solved
![]() |
If I declare a struct node, is the following legal in C++?
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++?
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++?
Last edited by titaniumdecoy; Jul 4th, 2008 at 6:12 pm.
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
instead -- if you have the boost libraries installed.
C++ Syntax (Toggle Plain Text)
scoped_array<node> nodes_array(new node[vector.size()]);
instead -- if you have the boost libraries installed.
![]() |
Similar Threads
- OPEN INVITATION for Link Exchange with our LAW,ATTORNEY,LEGAL,BEDT related websites! (Relevant Link Exchanges)
- Is invision power board free? :S (Existing Scripts)
- What is a proxy server and is it legal? (Network Security)
- Answers to legal ISSUES (IT Professionals' Lounge)
Other Threads in the C++ Forum
- Previous Thread: damages when executing console from MFC
- Next Thread: Missing Library in Compiling
| Thread Tools | Search this Thread |
api array assembly based basiccounter binary bitmap c++ c/c++ char class classes code coding compile console conversion count delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple network news node number numbertoword opengl output pakistan parameter pointer problem program programming project python random read recursion reference rpg stream string strings systray temperature template test text text-file thread tree url variable vector video visualstudio2008 win32 windows winsock word wordfrequency wxwidgets






