Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Some features lose the static keyword on functions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mvolkar
Junior Member

20 Posts

Posted - Jun 18 2018 :  1:46:14 PM  Show Profile  Reply with Quote
I don't know if this is by design or not, but I have noticed it for a while and finally decided to report the behavior. Basically, some features of Visual Assist (at least Change Signature and Create Implementation) seem to lose the static keyword from my function prototype. For example, given the following prototype:


static int TestFunction(int arg1, float arg7, double arg3);


If I use the Create Implementation feature, I get the following (notice no static keyword):

int TestFunction(int arg1, float arg2, double arg3)
{

}


Similarly, if I manually add the static keyword to the function definition and then invoke the Change Signature feature, it will remove the static keyword from the definition (but not the prototype).

I have encountered this behavior in multiple versions of Visual Assist, but have recently reproduced it with build 2270. It seems to me that this is a bug, but perhaps it is by design?

Zeblote
Tomato Guru

183 Posts

Posted - Jun 18 2018 :  2:18:32 PM  Show Profile  Reply with Quote
That's correct though. You put the static keyword in the declaraction only.
Go to Top of Page

mvolkar
Junior Member

20 Posts

Posted - Jun 18 2018 :  4:31:30 PM  Show Profile  Reply with Quote
I understand that this is legal C syntax. However, MISRA C:2012 Rule 8.8 states: "The static storage class specifier shall be used in all declarations of objects and functions that have internal linkage." It provides further amplification by saying: "Since definitions are also declarations, this rule applies equally to definitions." So, in our code, which is attempting to be more or less MISRA compliant, leaving the static keyword off of the definition is not an option.

I can understand the behavior of the Create Implementation feature, but I find the behavior of Change Signature to be irritating at best, since it removes something that I had there.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 20 2018 :  11:54:32 PM  Show Profile  Reply with Quote
Your reasoning makes sense. I've put in a bug report for you:

case=117210
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000