T O P I C R E V I E W |
.oisyn |
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) |
11 L A T E S T R E P L I E S (Newest First) |
feline |
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 |
bugfix |
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);
};
|
feline |
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. |
eve |
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 |
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 |
.oisyn |
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? |
feline |
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 |
feline |
Posted - Oct 31 2006 : 12:29:43 PM I am seeing the same thing with the underlining. That was rather unexpected.
case=3356 |
.oisyn |
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. |
.oisyn |
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 :) |
feline |
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? |