[VM] pending change to Cross platform sq.h

Andreas Raab andreas.raab at gmx.de
Fri Nov 28 15:57:39 UTC 2003


Hi John,

Why not make it

	char *getImageName(void);

instead? The declaration you are proposing is troublesome since any use of
imageName will now refer to a function pointer and since C allows you to
read and write that pointer, chances are that things will crash in unlikely
and unforeseen ways (consider some place that uses "extern char
imageName[]"). Using getImageName() will cause compiler and/or linker errors
and immediately point out the place of trouble.

Cheers,
  - Andreas

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org 
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On 
> Behalf Of John M McIntosh
> Sent: Friday, November 28, 2003 5:28 AM
> To: The general-purpose Squeak developers list
> Subject: [VM] pending change to Cross platform sq.h
> 
> 
> I'm proposing a change to sq.h such that
> 
> /* image file and VM path names */
> 
> extern char imageName[]
> 
> becomes
> 
> char *imageName(void);
> 
> The VM supplies an image name to the image open logic. This 
> image name  
> comes from the VM support routines once they decide what it 
> should be  
> as part of the startup process, or later when you do a save 
> or save as  
> operation.
> 
> Having a function return a pointer to the characters as a result of  
> calculations that determine issues like character encoding is 
> 'better'  
> than referring to an MacRoman ASCII byte string. This allows 
> the os-x  
> version to translate a unicode path name to the desired mapping when  
> needed, since that mapping
> might change under Smalltalk application control.
> 
> Yes, there will need to be a change set with this at some point to  
> alter Interp.c to generate imageName() versus imageName
> 
> --
> ==============================================================
> ========== 
> ===
> John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
> Corporate Smalltalk Consulting Ltd.  
> http://www.smalltalkconsulting.com
> 
> ==============================================================
> ========== 
> ===
> 
> 




More information about the Squeak-dev mailing list