Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Variable length array (Read 2042 times)
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Variable length array
Feb 15th, 2017 at 7:20pm
Print Post  
Arduino allows variable length arrays as local variables in functions:
Code (C++)
Select All
void readstring(char* buf, byte maxlen) {
	char buffer[maxlen+1];
        .....
        ..... 


This compiles and runs  Ok in both the Arduino IDE (1.8) and in VisualMicro but in the latter it's giving an 'red underline' error for the declaration of 'buffer': 'expression must have a constant value'. A minor bug, perhaps, but potentially a bit confusing to users.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Variable length array
Reply #1 - Feb 15th, 2017 at 8:21pm
Print Post  
Hi,

The vs intellisense isn't perfect for gcc. Microsoft are making huge strides in this area so it should improve sometime soon.

You can remove the red lines by addding a dummy.h file to the project which does not have to be #included in any code.

You simply need to define a slightly different method signature surrounded by #if _MSC_VER. This gives you the ability to change things so that vs is happy without altering the build.

http://www.visualmicro.com/page/Extending-Visual-Studio-Intellisense.aspx
« Last Edit: Feb 15th, 2017 at 8:22pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint