Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Problem using macros in declarations

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
JCo Posted - Jan 27 2009 : 1:14:05 PM
I have seen problems with VAX for some time if I use macros within declarations (tested with VC6 SP5 and VAX 1649 / 1711).

In the application I am working on macros like S_TEXTVAX_2 are used frequently and I am so dependent on VAX that I would like to see it working for this macros too.
I have produced some test code to find out where the problem could be but have not found anything conclusive.
All macros except for S_VAXTEST_2 are just attempts to see whether VAX can handle them or not.

VAX is not recognizing the variables aObjects4/6 at all (fine for me).
The VAX intellisense gives the following results if I place the caret after the closing square bracket for the following variables:
aObjects1[j] S_VaxObject& operator [] (size_t)
aObjects2[j] T& operator [] (size_t)
aObjects3[j] T& operator [] (size_t)
aObjects5[j] S_TESTVAX_5(aObjects5)
The intellisense for the .cStr() is working for aObjects1 and aObjects5 and shows me "const char *cStr() const". Intellisense for .cStr() is not working for aObjects2 and aObjects3.
The get() method shows the same problems as the operator [].

I hope that my posting is not too confusing.

Cheers,
Jochen.


// Begin code
class S_VaxObject
{
  public:
    S_VaxObject();
    ~S_VaxObject();

    const char *cStr() const;
};

template <class T, class Order>
class S_VaxArray;

template <class T>
class S_VaxOrder 
{
  public:
    S_VaxOrder();
    ~S_VaxOrder();
};

template <class T, class Order>
class S_VaxIter 
{
  public:
    S_VaxIter (S_VaxArray<T,Order>&);
    ~S_VaxIter ();
};

template <class T, class Order>
class S_VaxArray
{
  friend class S_VaxIter<T,Order>;

  public:

    S_VaxArray();
    virtual ~S_VaxArray();

    T& operator [] (size_t);
    T get();

    size_t length() const;
};

#define S_TESTVAX_2(TN)	    S_VaxArray < TN , S_VaxOrder < TN > > 
#define S_TESTVAX_3	    S_VaxArray < S_VaxObject , S_VaxOrder < S_VaxObject > > 
#define S_TESTVAX_4	    S_VaxObject	aObjects4[100]
#define S_TESTVAX_5(N)	    S_VaxObject	N[100]
#define S_TESTVAX_6A(T)	    T
#define S_TESTVAX_6B(N)	    N[100]

void VAX_test()
{
    S_VaxArray< S_VaxObject, S_VaxOrder<S_VaxObject> >	aObjects1;
    S_TESTVAX_2( S_VaxObject )					aObjects2;
    S_TESTVAX_3								aObjects3;
    S_TESTVAX_4;
    S_TESTVAX_5(aObjects5);
    S_TESTVAX_6A(S_VaxObject)						S_TESTVAX_6B(aObjects6);
    size_t									j;


    for(j=0; j<aObjects1.length(); j++)
    {
	aObjects1[j].cStr();
	aObjects2[j].cStr();
	aObjects3[j].cStr();
	aObjects4[j].cStr();
	aObjects5[j].cStr();
	aObjects6[j].cStr();

	aObjects1.length();
	aObjects2.length();
	aObjects3.length();

	aObjects1.get().cStr();
	aObjects2.get().cStr();
    }
}
// End code

2   L A T E S T    R E P L I E S    (Newest First)
JCo Posted - Jan 28 2009 : 04:40:00 AM
Good job finding the culprit. After I removed the blank form the macro definition VAX works as expected
accord Posted - Jan 27 2009 : 5:48:04 PM
I am seeing the same effect here. Thank you for the clear description.

case=23340

The problem was caused by the space after the template class name.

So if you change this

#define S_TESTVAX_2(TN) S_VaxArray < TN , S_VaxOrder < TN > >

into this

#define S_TESTVAX_2(TN) S_VaxArray< TN , S_VaxOrder < TN > >

the cStr in the "aObjects2[j].cStr()" and "aObjects2.get().cStr();" line will be recognized.

Wasn't easy to hunt down

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