Author |
Topic |
|
.oisyn
Tomato Guru
162 Posts |
Posted - Oct 30 2006 : 7:09:06 PM
|
It appears that VA X is not able to handle cv-qualified member function pointers as function parameters
struct S { };
void foo(void (S::*func)()); // #1
void foo(void (S::*func)() const); // #2 In #1, all is fine. In #2 however, it doesn't recognize the func parameter - it appears with a red error underline (also inside the function body). This is the case with every cv combination (const, volatile and const volatile) |
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 31 2006 : 10:22:29 AM
|
I am not seeing any underlining using VS2005 and VA 1540 Can you try changing the color VA uses to underline mistyped symbols, just to be sure that VA is doing the underlining. Do you see the problem with this test code? |
zen is the art of being at one with the two'ness |
|
|
.oisyn
Tomato Guru
162 Posts |
Posted - Oct 31 2006 : 12:13:42 PM
|
Right. If you comment out #1 then you see the error. #1 actually makes #2 work correctly :) |
|
|
.oisyn
Tomato Guru
162 Posts |
Posted - Oct 31 2006 : 12:19:57 PM
|
There are some coloring issues as well, by the way. It seems that if you define a function pointer variable (any function pointer, so also pointers like void(*func)()), it colors like a function. But if you define a function parameter in such a way, it colors like a variable. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 31 2006 : 12:29:43 PM
|
I am seeing the same thing with the underlining. That was rather unexpected.
case=3356 |
zen is the art of being at one with the two'ness |
Edited by - feline on Oct 31 2006 12:30:19 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 31 2006 : 5:05:12 PM
|
The coloring, do you mean something like this?
class felinePtr
{
public:
void (*ptrFn)(int, int);
void ptrParam(void (*func)());
};
It is a long time since I stored function pointers in a structure |
zen is the art of being at one with the two'ness |
|
|
.oisyn
Tomato Guru
162 Posts |
Posted - Nov 01 2006 : 08:53:53 AM
|
Yeah. In your example, "ptrFn" will be colored like a function, while "func" will be colored like a variable
It's arguable which one would be correct. They are obviously variables, but you can use them as functions as well. I myself am leaning toward "they're variables", but I can live with it if they were to be colored like functions. Maybe make it a VA X setting? |
Edited by - .oisyn on Nov 01 2006 08:56:32 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Nov 01 2006 : 12:07:50 PM
|
I have put in a bug, saying that both should be coloured as variables. Adding an option for this is definitely overkill
case=3380 |
zen is the art of being at one with the two'ness |
|
|
eve
Tomato Guru
Belgium
101 Posts |
Posted - Mar 30 2007 : 10:15:58 AM
|
I have exactly the same situation, but only in my case VAX does not recognize 'func' from the OP at all. Also only when the const keyword is set.
VAX 1549, VS2005.
regards, eli |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Mar 30 2007 : 1:01:33 PM
|
What code are you using? I have just tried:
class felinePtr
{
public:
void (*ptrFn)(int, int);
void ptrParam(void (*func1)());
void ptrParam(void (*func2)() const);
};
using VS2003 and VA 1549, and while "func2" is underlined as a mistyped symbol, this line does not compile. |
zen is the art of being at one with the two'ness |
|
|
bugfix
Tomato Guru
Germany
324 Posts |
Posted - Mar 30 2007 : 1:33:22 PM
|
of cause it doesn't:) only member function [pointers] can have modifiers
class felinePtr
{
public:
void (*ptrFn)(int, int);
void ptrParam(void (*func1)());
// change this
// void ptrParam(void (*func2)() const);
// to
void ptrParam(void (felinePtr::*func2)() const);
};
|
http://www.mf-sd.de |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Mar 30 2007 : 2:27:53 PM
|
Seeing your modified version, I remember seeing something similar in another thread recently:
http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=5991
On reflection I am fairly happy I don't know how to do this off hand, I have seen some deeply suspicious things done in C with function pointers *shudders at the memory*
case=5433
bugfix thank you for your help with this |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|