[PD] long int precision lost

Marc Boon marcboon at dds.nl
Mon Dec 6 17:01:06 CET 2004


chris clepper wrote:

> On Dec 6, 2004, at 2:34 AM, Marc Boon wrote:
> 
>>
>> to deal with this bad practice, you could define both:
>>
>> #define t_float double
>> #define float double
> 
> 
> That second one probably won't work with any compiler.  Redefining basic 
> data types should not be allowed - they are reserved for a reason.  If 
> nothing else, #define float double is a million times worse bad practice 
> compared to what you are trying to fix.  Donald Knuth would murder you 
> on the spot for doing that. ;)

#define float double
int main(int argc, char* argv[]) {
   printf("sizeof(float) = %d\n", sizeof(float));
   printf("sizeof(double) = %d\n", sizeof(double));
   return 0;
}

prints:
sizeof(float) = 8
sizeof(double) = 8

without the #define, it prints:
sizeof(float) = 4
sizeof(double) = 8





More information about the Pd-list mailing list