[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] "comp" is reserved word in Apple SC compiler?
From: |
mpsuzuki |
Subject: |
Re: [ft-devel] "comp" is reserved word in Apple SC compiler? |
Date: |
Fri, 28 Oct 2005 14:16:18 +0900 |
On Fri, 28 Oct 2005 13:29:51 +0900 (JST)
Masatake YAMATO <address@hidden> wrote:
>> - FMFont the_font = NULL;
>> - FMFontFamily family = NULL;
>> + FMFont the_font = ( FMFont ) NULL;
>> + FMFontFamily family = ( FMFontFamily ) NULL;
>
> FMFontFamily family = ( void* ) NULL;
>
>is not ok with the compiler?
Not enough. Speaking exactly, both of FMFont and FMFontFamily
in MPW are not pointer-type. I receive following errors:
-----------------------------------------------------------
SC :src:base:ftmac.c -o :objs:ftmac.c.o \
-ansi strict -includes unix \
-i :include: -i :src: -sym off -model far
SC C Compiler 8.9.0d3e1
Copyright (C) 1985-2000 by Apple Computer, Inc.
FMFont the_font = ( void * ) NULL;
^
File ":src:base:ftmac.c"; line 841 #Error: cannot implicitly convert
from: (void *)
to : (unsigned long)
#-----------------------
FMFontFamily family = ( void * ) NULL;
^
File ":src:base:ftmac.c"; line 842 #Error: cannot implicitly convert
from: (void *)
to : (short)
-----------------------------------------------------------
Now I think the exact solution for MPW might be:
FMFont the_font = 0;
FMFontFamily family = 0;
I found that MacTypes.h defines NULL as following.
-----------------------------------------------------------
#ifndef NULL
#if !defined(__cplusplus) && (defined(__SC__) || defined(THINK_C))
/* Symantec C compilers (but not C++) want NULL and nil to be (void*)0
*/
#define NULL ((void *) 0)
#else
/* in case int is 16-bits, make sure NULL is 32-bits */
#define NULL 0L
#endif
#endif
-----------------------------------------------------------
In the case that target CPU is PowerPC, NULL is defined to 0 in 32bit.
Therefore, when ftmac.c is compiled for MacOS on PowerPC, this problem
didn't arise. Unfortunately, Apple does not document about whether 0
is suitable for "undefined" or "unresolved" FMFont/FMFontFamily data.
In summary, I will replace "NULL" in the part by "0L".
How do you think of?
Regards,
mpsuzuki