[MLton] re: commit r4541

Wesley W. Terpstra wesley@terpstra.ca
Wed, 17 May 2006 12:11:49 +0200


> Took out "const" from
>
>   const void *GC_getTextEnd (void);
>   const void *GC_getTextStart (void);
>
> It was causing the following warnings when compiling the runtime.
>
>   gc/sources.c:64: warning: cast discards qualifiers from pointer  
> target type
>   gc/sources.c:65: warning: cast discards qualifiers from pointer  
> target type

Without that you get:
platform/darwin.c: In function 'GC_getTextEnd':
platform/darwin.c:12: warning: return discards qualifiers from  
pointer target type
platform/darwin.c: In function 'GC_getTextStart':
platform/darwin.c:21: warning: return discards qualifiers from  
pointer target type
... and the fact is that this memory region *is* constant. So, you  
lied to the compiler to silence a warning. Bad! =D

_dyld_get_image_header_containing_address returns const  
(unsurprisingly as its a text segment pointer)

When it comes to silencing warnings, I think it's better to leave a  
correct warning alone.