[cc65] Re: Macro naming

From: Jonathan Graham Harston <jgh1arcade.demon.co.uk>
Date: 2008-05-31 02:00:53
> Message-ID: <20080530090951.GA3166@trixie.musoftware.de>
 
> Again: Bad idea. Using these identifiers is inherently non portable, because
> you rely on something the compiler maker says. It may change every day and
if
 
If a compiler writer deliberately pisses off their userbase, then they will
and will deserve to have their compiler shunned by the world and their
neighbour.
 
> in your code. You can either set this #define in the makefile when calling
the
> preprocessor. Or you can use your own header file, for example machine.h
which
> does something like this:
[snip]
> With such a file, if compiler semantics change, or if you want to support a
> new compiler, you have to change ONE file, and not every file.
 
Exactly!!!! But what are the predefined macros?!?!?!?????
 
> Regarding code like this:
> 
> > #ifdef __riscos__
> >   setfileattr(fn, load, exec, attr);
> > #elif __win32__
> >   writeattr(fn, mdateoff, ro);
> > #elif __macos__
> >   filer_setinf(fn, macfdate(mdateoff));
> > #endif
> > etc...
> 
> Don't do it. Instead, supply your own set_file_attr() function with
semantics
> defined by you.
 
That ***IS***!!!!!!!! the set_file_attr() code. How else would you
write it?????
 
/* hostio.c - Interface with host system */
/* Platform-specific code in this module */
 
void set_file_attr(fn, fn_info)
char * fn; t_file * fn_info;
{
#ifdef __riscos__
   xswi(OS_File, 1, fn, fn_info.load, fn_info.exec, fn_info.attr);
#elif __win32__
   SetFileMDate(fn, fn_info.mdate, fn_info.mtime);
   SetFileAttribute(fn, fn_info.ro);
#elif __macos__
   filer_setinf(fn, macfdate(fn_info.mdate,fn_info.mtime));
#endif
}
 
or an example closer to cc65, the conio header file. You can't
even do something as simple as clearing the screen without
a conditional set of #define CH_CLR statements.
 
Are you really sitting up and saying to the world "fuck off and
stop daring to try and write anything that's not for Windows"?
Especially a community that *IS* developing a system that
doesn't target Windows.
 
Based on hours of trawling the web I found the documents in
http://mdfs.net/Docs/Comp/C and I'm just going to go ahead and
use __(lowercase)__.
 
-- 
J.G.Harston - jgh@arcade.demon.co.uk - mdfs.net/User/JGH
Youth has now fled. Their best years have been passed in the service
of the party. They are ageing and their ideals have also passed,
dispersed by the contrarities of daily struggles.
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat May 31 03:00:54 2008

This archive was generated by hypermail 2.1.8 : 2008-05-31 03:00:57 CEST