Re: DELETEP, FREEP, and friends

From: Mike Nordell (tamlin@algonet.se)
Date: Mon Jun 03 2002 - 12:50:03 EDT

  • Next message: Alan Horkan: "Re: FAQ -- can we implement advanced spelling feature #43?"

    Joaquín Cuenca Abela wrote:

    > #define DELETEP(ptr) \
    > do {} while(sizeof(*ptr) == 0); \
    > delete ptr; \
    > ptr = NULL;
    >
    > to prevent trying to delete a type not yet known to the compiler,
    > because the standard doesn't forces a compiler to issue a warning in
    > this case, and the result is undefined (the compiler can not known if
    > the type has a trivial destructor).

    ???

    How would the compiler allow deletion of an incomplete type that it
    therefore obviously has no accessible destructor for? IMO a reasonable
    compiler should issue diagnostics, and AFAIK any compiler would have to
    abort translation.

    /Mike - please don't cc



    This archive was generated by hypermail 2.1.4 : Mon Jun 03 2002 - 12:55:47 EDT