Re: [cc65] Apple II Libraries

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-05-06 00:32:25


Hi!

On Mon, May 05, 2003 at 11:04:03PM +0200, Groepaz wrote:
> clock_t clock(void)
> {
> 	return(0);
> }
>
> is a perfectly legal and standard compliant implementation of clock() (the
> standard doesnt say how long a clock-tick-period lasts, so it can be anything
> from microseconds to milleniums)

The standard has an explicit notation for "no information available". The
following paragraph is from ISO/IEC 9899:1999 (E), 7.23.2.1 "The clock
function":

------------------------------------------------------------------------------
The clock function returns the implementation's best approximation to the
processor time used by the program since the beginning of an
implementation-defined era related only to the program invocation. To
determine the time in seconds, the value returned by the clock function should
be divided by the value of the macro CLOCKS_PER_SEC. If the processor time
used is not available or its value cannot be represented, the function returns
the value (clock_t)(-1).
------------------------------------------------------------------------------

Unfortunately, neither returning zero nor returning -1 is really useful.

> now the question is, what about the implementation i have used for some
> hackery so far:

It would be difficult to come up with a matching CLOCKS_PER_SEC value, so I
don't think it's a good idea. It's ok to provide this (or a replacement)
function as part of Contiki, but I don't think it's suitable for cc65, which
aims to be standards compliant.

> > With the loadable module feature is it possible to do an initial system
> > check to load the correct one or to use a config file to load the correct
> > one?  This would avoid recompiling for each of the countless variations of
> > the Apples ][. Of course this may be too complicated or "expensive" to do.
>
> i think thats the best idea for that kinda stuff (although i dont know nothing
> about the apple2 so i couldnt say how *much* bloat that would add)

Loadable modules have a high overhead for small programs, because they need
the heap functions (and eventually the POSIX file i/o), so while this would be
possible, it is sub optimal.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-05-06 00:32:35 CEST