Bug 930

Summary: examples/topology-read/topology-example-sim.cc uses variable length array
Product: ns-3 Reporter: Quincy Tse <quincy.tse>
Component: examplesAssignee: Josh Pelkey <jpelkey>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs, tomh
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Proposed patch.

Description Quincy Tse 2010-05-31 01:54:51 UTC
topology-example-sim.cc uses variable length array, which cannot be compiled using some compilers (especially strict standards-compilent compilers like clang). Variable length array is part of C99 but does not comply with C++ standards (not in C++98, rejected for C++0x).
Comment 1 Quincy Tse 2010-05-31 02:13:08 UTC
Created attachment 902 [details]
Proposed patch.
Comment 2 Josh Pelkey 2010-08-05 14:16:18 UTC
Are we making a decision here to say no to variable-length arrays in ns-3?
Comment 3 Tom Henderson 2010-08-06 14:26:51 UTC
(In reply to comment #2)
> Are we making a decision here to say no to variable-length arrays in ns-3?

I slightly lean towards this because it is not standard and there are other viable solutions in C++ (such as new[] or std::vector).

If no other comments from developers I suggest to apply the patch and add this statement to the coding style:

"variable-length arrays are not standards-compliant C++; use instead std::vector, std::string, or operator new[] when your code might call for a variable-length array."
Comment 4 Josh Pelkey 2010-08-10 23:23:50 UTC
changeset: caa2dd9bbbce

I also updated the webpage, changeset: f27e0846b0c4