[M3devel] Getting IsLittleEndian as a Modula-3 CONST

Jay K jay.krell at cornell.edu
Tue May 28 08:17:58 CEST 2013


 > >> I know this can be done using m3makefiles and the build system, but I 
 > >> am hoping someone can point to a place where it already exists.  I need 

 
We already do expose this, TARGET_ENDIAN, via m3makefile as you allude.
See here:
http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/m3core/src/float/m3makefile?rev=1.38;content-type=text%2Fplain
 

Also a good place to expose this would be here:
  http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/m3core/src/runtime/common/m3makefile?rev=1.34;content-type=text%2Fplain  
  => http://modula3.elegosoft.com/cgi-bin/cvsweb.cgi/cm3/m3-libs/m3core/src/runtime/common/Compiler.tmpl  
  => Compiler.ThisEndian or such.  

 
 Why do you need it? 
 Very little code cares about this sort of thing, and you can usually figure it out easily enough portably at runtime.
 

 - Jay




 
> Date: Sun, 26 May 2013 21:02:21 -0500
> From: rodney_bates at lcwb.coop
> To: m3devel at elegosoft.com
> Subject: Re: [M3devel] Getting IsLittleEndian as a Modula-3 CONST
> 
> Yes. And so says Modula-3, 2.6.15, Constant Expressions.
> ADR isn't legal in constant expressions either.
> 
> On 05/26/2013 02:54 PM, Dragiša Durić wrote:
> > My first idea (very fast&dirty) was
> >
> > CONST
> >    BigEndian = LOOPHOLE(1, ARRAY[0..7] OF BITS 8 FOR [0..255])[0] = 0;
> >
> > But this is not constant expression, so says cm3 :).
> >
> > --
> > Dragiša Durić
> > dragisha at m3w.org <mailto:dragisha at m3w.org>
> >
> >
> >
> > On May 26, 2013, at 8:47 PM, Rodney M. Bates wrote:
> >
> >> I know this can be done using m3makefiles and the build system, but I
> >> am hoping someone can point to a place where it already exists.  I need
> >> a Module-3 CONST that tells endianness of the machine we are running
> >> on, that is available to code in m3core.
> >
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20130528/990bbc43/attachment-0002.html>


More information about the M3devel mailing list