Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1640: Troubles with Pointer Macro

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
drzoom Posted - Jun 26 2008 : 04:53:11 AM
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?

6   L A T E S T    R E P L I E S    (Newest First)
beylevem Posted - Jun 27 2008 : 12:24:27 PM
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?
feline Posted - Jun 27 2008 : 10:53:30 AM
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.
innes Posted - Jun 27 2008 : 09:38:43 AM
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.
drzoom Posted - Jun 27 2008 : 02:21:09 AM
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.
feline Posted - Jun 26 2008 : 5:45:24 PM
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.
innes Posted - Jun 26 2008 : 10:07:42 AM
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)

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