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
 1640: Troubles with Pointer Macro
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

drzoom
Ketchup Master

Switzerland
57 Posts

Posted - Jun 26 2008 :  04:53:11 AM  Show Profile  Reply with Quote
Hi

I have some problems with a macro we use to declare typedefs for boost::shared_ptr and boost::weak_ptr. It's strange, the typedefs are sometimes listed, sometimes red underlined. But most of the times the intellisense doesn't work.

There is a header file "SmartPointerUtil.h":

namespace boost // fwd declaration
{
  template<class T> class shared_ptr;
  template<class T> class weak_ptr;
}
#define DECLARE_SMART_PTR(type)\class type;\typedef boost::shared_ptr<type> type##Ptr;\typedef boost::weak_ptr<type> type##WeakPtr;\typedef boost::shared_ptr<const type> type##PtrConst;\typedef boost::weak_ptr<const type> type##WeakPtrConst;


And there are header files with the declarations of all the pointers (called "Ptr.h" in the directory of the namespace):


#include "SmartPointerUtil.h"

#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>

namespace bl {
namespace fitting {
namespace slotconceptmodel {

DECLARE_SMART_PTR( Backend );
DECLARE_SMART_PTR( CommonEffectMap );
DECLARE_SMART_PTR( CommonHearingInstrument );
DECLARE_SMART_PTR( CommonModel );
DECLARE_SMART_PTR( CommonProductId );
// ....

}
}
}


I already tried to add this lines to the VA "Stdafx.h" or "StdafxVa.h", but without success:


#define DECLARE_SMART_PTR( type ) \class type;\typedef type* type##Ptr;\typedef type* type##WeakPtr;\typedef const type* type##PtrConst;\typedef const type* type##WeakPtrConst;


What can I do?


best regards
Tobias

Edited by - drzoom on Jun 26 2008 05:09:57 AM

innes
New Member

2 Posts

Posted - Jun 26 2008 :  10:07:42 AM  Show Profile  Reply with Quote
I am having a similar problem. I have a macro which expands out to declare a C++ CLI property getter that returns a pointer to an interface. However, I don't get intellisense when I access this property in the source.

Here is an equivalent macro with code that accesses the property.

#define INTERFACEPTR(name) property name* name##Pointer { name* get() {...elided...} }

ref class Example
{
  INTERFACEPTR(IMyInterface)
  ...
  void Test()
  {
    IMyInterfacePointer-> ...IMyInterfacePointer methods dont appear...
  }
}


I tried adding the macro definition to the Visual Assist stdafx.h file, to see if this would fix the problem, but it had no effect.

(NB: I'm testing VA at the moment, and doubt I could persuade anyone the team to go with it if we had to use this rickety 'VA stdafx.h' 'feature' anyway, but I thought I'd give it a go)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jun 26 2008 :  5:45:24 PM  Show Profile  Reply with Quote
Unfortunately I am not sure there is much you can do. VA currently has problems with any macro that uses ## to construct names:

case=729

which is probably what is causing the problems here.

zen is the art of being at one with the two'ness
Go to Top of Page

drzoom
Ketchup Master

Switzerland
57 Posts

Posted - Jun 27 2008 :  02:21:09 AM  Show Profile  Reply with Quote
A new challenge for the developers! ;-)

Because this is really annoying. And especially there is no workaround, because writing all this pointer names by hand is not really an option.

best regards
Tobias
Go to Top of Page

innes
New Member

2 Posts

Posted - Jun 27 2008 :  09:38:43 AM  Show Profile  Reply with Quote
Now I'm confused :)

I'm now getting intellisense on the property that's declared in the macro (so, when I type IInterfaceNamePointer-> I get a dropdown with the right stuff in it)!

I dont know what happened to make this start working.

BUT, at the same time, VA red-underlines method calls on the same object (so, after I've typed IInterfaceNamePointer->get_Something(...), 'get_Something' is underlined with a red wavy line).

Seems like some bits of VA understand what's going on and other bits don't.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jun 27 2008 :  10:53:30 AM  Show Profile  Reply with Quote
drzoom this is down as a relatively urgent bug. In general macro's are *hard*. Remember the compiler never has to think about them, since they are all expanded by the pre-processor. VA does not have the same luxury. Plus I have seen some very scary things done with macros.

innes I would guess that the listboxes you are seeing are coming from the IDE's intellisense. Sometimes the IDE's intellisense works better, and sometimes VA's intellisense works better.

The other possibility is that these are suggestions, so VA is simply saying "you may want this" without actually understanding what the code is saying.

zen is the art of being at one with the two'ness
Go to Top of Page

beylevem
Tomato Guru

102 Posts

Posted - Jun 27 2008 :  12:24:27 PM  Show Profile  Reply with Quote
If this is something which got broken recently, can you please tell us which version is the most recent version which doesn't manifest this problem?
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