Bug 1050

Summary: ISO C++ forbids variable length array
Product: ns-3 Reporter: John Abraham <john.abraham.in>
Component: generalAssignee: John Abraham <john.abraham.in>
Status: NEW ---    
Severity: trivial CC: hemanthnarra222, mathieu.lacage, ns-bugs, quincy.tse, tgoff
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Patch againist wimax modules
Patch against tap-bridge
Patch against applications module
Patch againist dsdv modules
Patch againist emu modules
Patch againist internet modules
Patch againist network modules

Description John Abraham 2011-02-03 06:08:30 EST
We have several instances where we use array declarations similar to
int i = 5 ;
int array[i]; 

rather than 
int array[5];

This raises portability concerns. It was discovered while I ported the basic simulator to native Windows. (Visual C++ with Windows API support treats them as errors).

Using "-ansi -pedantic" flags in "wscript" during compilation we see warnings such as 
../src/internet-stack/icmpv6-header.cc:1011: warning: ISO C++ forbids variable length array ‘data’
Comment 1 Quincy Tse 2011-04-18 03:17:26 EDT
Created attachment 1074 [details]
Patch againist wimax modules
Comment 2 Quincy Tse 2011-04-18 03:18:31 EDT
Created attachment 1075 [details]
Patch against tap-bridge
Comment 3 Quincy Tse 2011-04-18 03:20:17 EDT
Comment on attachment 1074 [details]
Patch againist wimax modules

(sorry - wrong bug)
Comment 4 Quincy Tse 2011-04-18 03:21:23 EDT
Created attachment 1076 [details]
Patch against applications module
Comment 5 Quincy Tse 2011-04-18 03:22:08 EDT
Created attachment 1077 [details]
Patch againist dsdv modules
Comment 6 Quincy Tse 2011-04-18 03:22:47 EDT
Created attachment 1078 [details]
Patch againist emu modules
Comment 7 Quincy Tse 2011-04-18 03:25:00 EDT
Created attachment 1079 [details]
Patch againist internet modules
Comment 8 Quincy Tse 2011-04-18 03:25:51 EDT
Created attachment 1080 [details]
Patch againist network modules
Comment 9 Mathieu Lacage 2011-08-10 12:55:38 EDT
(In reply to comment #5)
> Created attachment 1077 [details]
> Patch againist dsdv modules

patch does not look like it has much to do with variable length arrays. makes tests fail.
Comment 10 Mathieu Lacage 2011-08-10 12:56:42 EDT
(In reply to comment #2)
> Created attachment 1075 [details]
> Patch against tap-bridge

patch buggy: controllen is initialized to incorrect value. i.e., sizeof() gives different values. same for emu patch below.
Comment 11 Mathieu Lacage 2011-08-10 13:10:13 EDT
partially applied: changeset: 91df05070541

It's fascinating to see this patch make some wholly unrelated olsr/dsdv tests fail.