Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 C++ wrong syntax coloring of pointer variable

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
tangens Posted - Nov 10 2011 : 09:56:27 AM
VAX wrongfully colors variable as a method/function when declaring a pointer variable with initialization using ()

int *myVariable(nullptr);


see attached image:
myVariable is colored as a method while
myVariable2 is colored as a variable.




system info:
VA_X.dll file version 10.6.1859.0 built 2011.10.02
DevEnv.exe version 10.0.40219.1 Professional
msenv.dll version 10.0.40219.1
Comctl32.dll version 6.10.7601.17514
Windows 7 6.1 Build 7601 Service Pack 1
4 processors (x86-64;
WOW64)

Platform: Custom
Stable Includes:
C:\\DevStudio\\Vs2010\\VC\\include;
C:\\DevStudio\\Vs2010\\VC\\atlmfc\\include;
C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include;
C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include;
C:\\DevStudio\\extra_x32\\Boost_1_43_0\\include;
C:\\DevStudio\\extra_x32\\Qt_4_7_0_x32_vs2010_dll\\include;
C:\\DevStudio\\extra_x32\\Cppunit_1_10_2_VS2010\\include;
C:\\DevStudio\\extra_x32\\gmock-1.4.0_vs2010\\include;
C:\\DevStudio\\extra_x32\\qxcppunit_x32_vs2010\\include;
C:\\DevStudio\\extra_x32\\QtWinMigrate_2.8.1_x32_vs2010\\src;

Other Includes:

Stable Source Directories:
C:\\DevStudio\\Vs2010\\VC\\atlmfc\\src\\mfc;
C:\\DevStudio\\Vs2010\\VC\\atlmfc\\src\\mfcm;
C:\\DevStudio\\Vs2010\\VC\\atlmfc\\src\\atl;
C:\\DevStudio\\Vs2010\\VC\\crt\\src;
C:\\DevStudio\\extra_x32\\Qt_4_7_0_x32_vs2010_dll\\src;
C:\\DevStudio\\extra_x32\\QtWinMigrate_2.8.1_x32_vs2010\\src;

3   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Nov 14 2011 : 7:04:35 PM
*ooops* I was superficial and handled different things as they would have been the same. You are right indeed, your first example is an int pointer:

case=60805

However, your second example without the paren is a local function declaration:
int *myfunctionpointer(int);

You need parens to get a function pointer:
int (*myfunctionpointer)(int);

So we don't have to differentiate them based on the params. I messed up this in my first post but I was wrong.
tangens Posted - Nov 14 2011 : 04:03:25 AM
I don't agree that this is a function pointer.
It is a pointer to an int, but I happen to initialize it via () instead of =.

These are function pointers:



I would think they are distinguishable from pointer to int variables because of the data types between the (),
whereas my variable uses a value (nullptr in my case).
(I might go a bit too fast here, I might be missing some other cases?)
accord Posted - Nov 11 2011 : 3:20:13 PM
This "variable" is often called a "function pointer". It is a pointer to a function. So the function (where the variable is pointing to) is colored as a function :) I think that this is a borderline case and that the current working is reasonable. But let's see what others think about this :) I wouldn't say that either version is bad.

I checked and it seems to be consistent so both
int *myVariable(nullptr);
and
int (*myVariable2)(nullptr);
is colored as a function.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000