Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Toggle auto-generating function prototypes (Read 8959 times)
EhNon
Newbies
*
Offline



Posts: 1
Toggle auto-generating function prototypes
May 6th, 2013 at 3:03am
 
So yeah, because all the function prototypes are created automatically you can't pass or return typedef'd stuff. So it would be cool to be able to turn it off. (They don't exist yet, when the auto-generated prototype is created).
Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11114
United Kingdom
Re: Toggle auto-generating function prototypes
Reply #1 - May 6th, 2013 at 4:20am
 
Good idea for advanced users. In the next release this is implemented as a project property:-

Quote:
Category="Micro General (Project Global)"

Description="Auto generation of prototypes for sketch source code. The default is True for Arduino projects. This property is for advanced users.

Name="Generate Prototypes"

It might also be useful to have some sort of //<no-proto/> comment that could be used to skip individual prototypes. Would this be useful? If so then we can add it to the list for a version later this year.

Thanks for the suggestion
Back to top
« Last Edit: May 6th, 2013 at 12:55pm by Tim@Visual Micro »  

Tim Leek
home
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11114
United Kingdom
Re: Toggle auto-generating function prototypes
Reply #2 - May 9th, 2013 at 9:39pm
 
This feature is implemented in the latest download. Thanks.

Note to others: If you switch off auto generation of prototypes your project will loose compatibility with the Arduino Ide because compilation will fail
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
CapnBry
Junior Member
**
Offline



Posts: 32
Re: Toggle auto-generating function prototypes
Reply #3 - Jun 5th, 2013 at 2:37pm
 
Sweet! This is especially useful for anyone trying to use enumerated types in their sketch:
Code:
typedef enum {RANDOM, IMMEDIATE, SEARCH} StrategyType;

void doLogic(StrategyType s)
{
//code
}

void loop()
{
  doLogic(RANDOM);
  doLogic(IMMEDIATE);
  doLogic(SEARCH);
}
 


This code won't compile under Arduino or default Visual Micro thanks to the function prototype for doLogic() being inserted before the enum definition. The only way around this previously was to define your enum in a header which you then included in the main sketch, which is annoying if you want to keep everything all tidy in one file.

If you turn off prototype generation, zing! Works great.
Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11114
United Kingdom
Re: Toggle auto-generating function prototypes
Reply #4 - Jun 5th, 2013 at 3:59pm
 
Thanks for confirming the feature works and for the example, I will add it to the wiki.
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print