Marcin 'Qrczak' Kowalczyk wrote:
> IMHO the following should be efficient, calling the function only
> once, near the time of the first use (if not, should be fixed):
>
> foreign import aConstant :: Int
> ------------------------------------
> #include <header.h>
> int aConstant (void)
> {
> return A_CONSTANT;
> }
Granted, but this still doesn't bring you back that single nice
machine instruction it would be in the case of litlits. OK, OK,
this is an O(1) optimization and going via C is bad, but sometimes
it's more efficient to be a bad boy... ;-)
> A tool could be helpful in massive generating such functions...
And if you need a tool (which I desperately would), it can produce
the constants right away, without any foreign import. Hmmm, how
does this fit with Green Card? And the tool would seem conspicuously
like a cut-down version of Manuel's C->HS.
Cheers,
Sven
--
Sven Panne Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen Oettingenstr. 67
mailto:[EMAIL PROTECTED] D-80538 Muenchen
http://www.informatik.uni-muenchen.de/~Sven.Panne