SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: byates on March 21, 2009, 07:51:14 PM

Title: SE2009: Slick-C Pointer initialization problems in classes
Post by: byates on March 21, 2009, 07:51:14 PM
The following applies to Slick-C macros using classes:

When initializing a pointer to null within a class, I get an compilation error saying the type is invalid.  The same initiailzation works fine outside of a class.  This problem is new to 2009.

In the following code example, Ptr1 produces a type mismatch error while Ptr2 works just fine.

Code: [Select]
#pragma option(pedantic,off)
class test
    {
    int* Ptr1 = null;  // Type mismatch
    };

int* Ptr2 = null; // Ok
Title: Re: SE2009: Slick-C Pointer initialization problems in classes
Post by: byates on March 27, 2009, 04:22:32 PM
A work around to this issue is to initialize the pointer member to null in the class constructor.  It seems (so far) that the only place a pointer can't be set to null is in the member declaration.