digitalmars.D.learn - Null variadic parameter.
- AJG (7/7) Aug 17 2005 Hi,
- Jarrett Billingsley (4/9) Aug 17 2005 Why wouldn't it be? Casting to a void* is safe, since you can't read or...
- AJG (5/14) Aug 17 2005 What if it's a short, or a class, or something else other than an actual
- Ben Hinkle (9/24) Aug 17 2005 Check that the TypeInfo of the parameter subclasses TypeInfo_Pointer. Th...
Hi, How can I test to see if a variadic parameter is null? I don't think something like: if (va_arg!(void*)(_argptr) == null) printf("Null"); Is safe. Thanks, --AJG.
Aug 17 2005
"AJG" <AJG_member pathlink.com> wrote in message news:de0p3i$q1p$1 digitaldaemon.com...Hi, How can I test to see if a variadic parameter is null? I don't think something like: if (va_arg!(void*)(_argptr) == null) printf("Null"); Is safe.Why wouldn't it be? Casting to a void* is safe, since you can't read or write it.
Aug 17 2005
Hi,What if it's a short, or a class, or something else other than an actual pointer, would it still work? Thanks, --AJG.How can I test to see if a variadic parameter is null? I don't think something like: if (va_arg!(void*)(_argptr) == null) printf("Null"); Is safe.Why wouldn't it be? Casting to a void* is safe, since you can't read or write it.
Aug 17 2005
"AJG" <AJG_member pathlink.com> wrote in message news:de0sv9$sj3$1 digitaldaemon.com...Hi,Check that the TypeInfo of the parameter subclasses TypeInfo_Pointer. That way you'll know the parameter isn't actually a short or a class reference. TypeInfo_Pointer is defined in object.d which is automatically imported so it is always available. Note I haven't actually tried this - I just assume the typeid of a pointer subclasses TypeInfo_Pointer otherwise why have something called TypeInfo_Pointer :-PWhat if it's a short, or a class, or something else other than an actual pointer, would it still work? Thanks, --AJG.How can I test to see if a variadic parameter is null? I don't think something like: if (va_arg!(void*)(_argptr) == null) printf("Null"); Is safe.Why wouldn't it be? Casting to a void* is safe, since you can't read or write it.
Aug 17 2005