<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Mika, the build process hasn't "really" changed. There was always an occasional "bump" where you had to build the compiler skipping m3core/libm3, and then again with building m3core/libm3. It used to happen any time a target was added. But I fixed that. Then it also happened with WIDECHAR, then with LONGINT, then with LONGCARD and the VAL changes. There was also a "bump" when cm3 started using m3core's TextUtils, though I've removed that -- I've removed a few "bumps" where possible, but some remain. Old cm3 cannot compile "modern" m3core/libm3.<BR>
<BR>
<BR>
Other than needing this "skipping" of m3core/libm3, you can actually build the current system starting with an old 5.x release.<BR>
I haven't tried 5.1/4.1/3.6 yet but maybe I will soon. I actually use current configuration files when doing that though, so that probably inhibits 3.6 (unless I use its configuration files).<BR>
<BR>
<BR>
Having skimmed through <A href="http://yarchive.net/comp/longlong.html">http://yarchive.net/comp/longlong.html</A> ... wow folks are *adamant* that C needed long long, like in order to 32bit systems to cross compile for 64bit... I continue to suspect that infix operators and efficiency are the primary motivators. "efficiency" in terms of being sure to avoid function calls for some operations, which is likely doable otherwise.<BR>
<BR>
<BR>
People really want their compiler to handle multiple precision arithmetic, at least to attain 64bit precision.<BR>
It is nice and convenient, if not strictly necessary.<BR>
<BR>
<BR>
Another view though, besides "interop" with C, is "keeping up" with C.<BR>
Again that link suggests C has had long long for something like 18 years. We are late.<BR>
Even C changed, C99 must be around 10 years old now? and has lnog long.<BR>
Granted, I tend to think of C like you think of Modula-3 --- nice that it never changes.<BR>
It is somewhat small, very well known. One only needs keep up with libraries now :) and one can assume a certain baseline is everywhere and write portable code to it. (But I've happened upon K&R compiler *recently* -- HP-UX/hppa only bundles a compiler for purposes of changing kernel configuration (constant data) and relinking kernel. The libraries that comprise the kernel are shipped. K&R suffices and is therefore bundled. Best is probably to use that compiler to build old gcc, and then use old gcc to build current gcc (current gcc can't be compiled with K&R)).<BR>
<BR>
<BR>
WIDECHAR is maybe a bit funny.<BR>
Notice how in C and C++, until subtle small later changes in C++, wchar_t was just a typedef of unsigned short, you could write literals L'a' and L"foo", and there was a bunch of library functions -- again, the "language" aspect being just literals, close to the situation with LONGINT where the language provides literals and infix notation.<BR>
<BR>
<BR>
In fact I think the next version of C++ improves the situation for "literals" of user defined types, like the "constexpr" feature will make constructors better able to stand in for literals, I think.<BR>
<BR>
<BR>
- Jay<BR><BR> <BR>> From: hosking@cs.purdue.edu<BR>> Date: Sun, 18 Apr 2010 20:38:43 -0400<BR>> To: mika@async.async.caltech.edu<BR>> CC: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] INTEGER<BR>> <BR>> Mika,<BR>> <BR>> First off, I'd be very interested to know what the issues are with LONGINT and stubgen. We are building that every day in regression testing. It would be really good to get some precise feedback.<BR>> <BR>> True, LONGINT is integrated with all of the language tools (same as WIDECHAR).<BR>> <BR>> I suppose that is the price we pay for the language having evolved. Nevertheless, CM3 should be totally backward compatible with the green book. There is no reason it should not build packages from PM3 or SRC.<BR>> <BR>> Now, this is not to say that perhaps we haven't overreached with LONGINT given that 64-bit is more prevalent. But then it is also useful to be able to interoperate with C libraries. The previous interfacing was pretty much a kludge, using ARRAY[0..1] OF INTEGER for "long long" but then not propagating the double INTEGER value properly throughout the Modula-3 libraries.<BR>> <BR>> I'm sorry to say that EWD was not particularly renowned for his practicality; pedant more like. Nice to be high and mighty but we also need to interact with the real world.<BR>> <BR>> We should be able to make this work. Is there a better alternative? Revoke LONGINT, and WIDECHAR?<BR>> <BR>> On 18 Apr 2010, at 15:59, Mika Nystrom wrote:<BR>> <BR>> > <BR>> > My problem is really just that it's ugly. LONGx is showing up as an issue<BR>> > in all sorts of low-level code, which is not surprising since Modula-3<BR>> > with LONGx is not the same language as Modula-3 (maybe we should call<BR>> > it Modula-3+?) <BR>> > <BR>> > The compiler bootstrapping process has gotten more complicated due to it,<BR>> > and when I cvs updated m3tk yesterday stubgen wouldn't compile because there<BR>> > was something "long" in it that wasn't there before. I have no idea what<BR>> > library or components I needed to update and recompile and didn't have the<BR>> > time to deal with the issue at the time.<BR>> > <BR>> > And the new m3tk, stubgen, and compiler(?) won't compile using PM3 or<BR>> > SRC M3 since we're no longer using the language of the Green Book.<BR>> > (Same comment goes for WIDECHAR, by the way.)<BR>> > <BR>> > One of the wonderful things about Modula-3 *used to be* that I could<BR>> > grab some old package from DECSRC and just use it without changes since<BR>> > no one had messed with the language definition. This is still true as<BR>> > far as programs that just use the tools go, but it's no longer true for<BR>> > programs that process Modula-3 code as input data. Of which there are<BR>> > more than a few: many aspects of Modula-3 were specifically designed to<BR>> > make the language easy to process by program, as an intermediate format<BR>> > and whatnot.<BR>> > <BR>> > To quote E.W.D.:<BR>> > <BR>> > 'Unfathomed misunderstanding is further revealed by the term "software<BR>> > maintenance", as a result of which many people continue to believe that<BR>> > programs and even programming languages themselves are subject to wear<BR>> > and tear. Your car needs maintenance too, doesn't it? Famous is the story<BR>> > of the oil company that believed that its PASCAL programs did not last<BR>> > as long as its FORTRAN programs "because PASCAL was not maintained".'<BR>> > <BR>> > LONGx is causing me to have to do "software maintenance" on Modula-3<BR>> > programs... for a feature that no one appears to be using and is quickly<BR>> > becoming irrelevant.<BR>> > <BR>> > Mika<BR>> > <BR>> > <BR>> > Tony Hosking writes:<BR>> >> In the language spec NUMBER(a) and LAST(a) - FIRST(a) + 1 are *not* =<BR>> >> defined to mean the same thing for all types.<BR>> >> NUMBER does have an INTEGER value, as expected for subranges of LONGINT =<BR>> >> that are not too large.<BR>> >> This is as it has always been for subranges of INTEGER that are not too =<BR>> >> large.<BR>> >> <BR>> >> Mika, I'm not sure I see any of the problems you are worrying about in =<BR>> >> the current definition of LONGINT/LONGCARD.<BR>> >> <BR>> >> On 18 Apr 2010, at 03:49, Mika Nystrom wrote:<BR>> >> <BR>> >>> =20<BR>> >>> Jay I know most of this, and it doesn't really answer the question<BR>> >>> "what is it for?"<BR>> >>> =20<BR>> >>> I think we've already established that LONGINT isn't useful for =<BR>> >> counting<BR>> >>> anything that might actually reside in the computer's memory: it makes<BR>> >>> no sense as an array index, for instance. INTEGER suffices for that.<BR>> >>> =20<BR>> >>> I thought that the only real reason for LONGINT was to match C's<BR>> >>> declaration of various seek-related routines on 32-bit machines.<BR>> >>> That's not a very good reason.<BR>> >>> =20<BR>> >>> C++ succeeds because it does very well in the area(s) it is good at.<BR>> >>> People who want to program in C++ will clearly program in C++, not<BR>> >>> Modula-3. Modula-3 is never, ever going to be the language of choice =<BR>> >> for<BR>> >>> people who want lots of snazzy infix operators. Modula-3 is supposed =<BR>> >> to<BR>> >>> be a language with about as powerful semantics as C++ and an extremely<BR>> >>> simple syntax and definition---snazzy infix is one of the things you<BR>> >>> give up for that. I don't see how LONGINT fits into this picture.<BR>> >>> Now we have LONGCARD too? And it's infected the definitions<BR>> >>> of FIRST and LAST? But not NUMBER... argh!<BR>> >>> =20<BR>> >>> so,<BR>> >>> =20<BR>> >>> NUMBER(a) and LAST(a) - FIRST(a) + 1<BR>> >>> =20<BR>> >>> no longer mean the same thing? Are we going to see lots of comments<BR>> >>> in generics in the future where it says T may not be an open array<BR>> >>> type nor an array type indexed on LONGINT or a subrange thereof?<BR>> >>> =20<BR>> >>> Your comments about different parameter-passing techniques was what I =<BR>> >> was<BR>> >>> trying to address with my suggestion to have a pragma for this---just =<BR>> >> to<BR>> >>> match C (and Fortran?), of course. Name me a single Modula-3 =<BR>> >> programmer<BR>> >>> who cares in what order the bits in his parameters are pushed on the<BR>> >>> stack in a Modula-3-to-Modula-3 call.<BR>> >>> =20<BR>> >>> And I am definitely in that school of thought that says that =<BR>> >> programming<BR>> >>> languages should not "evolve". Better to leave well enough alone.<BR>> >>> =20<BR>> >>> How much Modula-3 code has been written that uses LONGINT? Other than<BR>> >>> to talk to C? I've certainly never used it.<BR>> >>> =20<BR>> >>> Mika<BR>> >>> =20<BR>> >>> =20<BR>> >>> =20<BR>> >>> Jay K writes:<BR>> >>>> --_264cb69b-0215-44c3-807c-8b4d8ea0ea59_<BR>> >>>> Content-Type: text/plain; charset=3D"iso-8859-1"<BR>> >>>> Content-Transfer-Encoding: quoted-printable<BR>> >>>> =20<BR>> >>>> =20<BR>> >>>> TYPE LONGINT =3D3D ARRAY [0..1] OF INTEGER on a 32bit system is very =<BR>> >> close to=3D<BR>> >>>> LONGINT.<BR>> >>>> =20<BR>> >>>> Plus treating it opaquely and providing a bunch of functions to =<BR>> >> operate on=3D<BR>> >>>> it.<BR>> >>>> =20<BR>> >>>> Just as well therefore could be RECORD hi=3D2Clo:LONGINT END (see =<BR>> >> LARGE_INTE=3D<BR>> >>>> GER and ULARGE_INTEGER in winnt.h)<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> Differences that come to mind:<BR>> >>>> =20<BR>> >>>> infix operators <=3D3D=3D3D=3D3D=3D20<BR>> >>>> =20<BR>> >>>> possibly passed differently as a parameter<BR>> >>>> =20<BR>> >>>> or returned differently as a result<BR>> >>>> =20<BR>> >>>> ie. probably "directly compatible with" "long long"=3D2C passed by =<BR>> >> value (o=3D<BR>> >>>> f course you could always pass by pointer and achieve compatibilitity =<BR>> >> trivi=3D<BR>> >>>> ally)<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> I have to say though=3D2C the biggest reason is in-fix operators. =<BR>> >> Convenient =3D<BR>> >>>> syntax.<BR>> >>>> =20<BR>> >>>> C++ is the best and some way worst of example of the general right =<BR>> >> way to d=3D<BR>> >>>> o this -- you let programmers define types and their infix operators. =<BR>> >> Other=3D<BR>> >>>> languages just come with a passle of special cases of types that have =<BR>> >> in-f=3D<BR>> >>>> ix operators.<BR>> >>>> =20<BR>> >>>> A good example is that Java infix operator + on string=3D2C besides =<BR>> >> the vario=3D<BR>> >>>> us integers=3D2C and nothing else.<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> I think C# lets you define operators=3D2C yet people don't complain =<BR>> >> that it i=3D<BR>> >>>> s "a mess" as they do of C++.<BR>> >>>> =20<BR>> >>>> I think Python does now too.<BR>> >>>> =20<BR>> >>>> So it is feature growing in popularity among "mainstream" =<BR>> >> languages=3D2C not =3D<BR>> >>>> just C++.<BR>> >>>> =20<BR>> >>>> C++ of course is extremely mainstream=3D2C but also a favorite =<BR>> >> target. (ht=3D<BR>> >>>> tp://www.relisoft.com/tools/CppCritic.html)<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> We also have subranges of LONGINT.<BR>> >>>> =20<BR>> >>>> I'm not sure what the generalization of subranges are=3D2C granted.<BR>> >>>> =20<BR>> >>>> Maybe some sort of C++ template that takes constants in the template =<BR>> >> and d=3D<BR>> >>>> oes range checks at runtime. Yeah=3D2C maybe.<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> And as you point out=3D2C convenient literal syntax.<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> People reasonably argue for library extension in place of language =<BR>> >> extensio=3D<BR>> >>>> n=3D2C but that requires a language which is flexible enough to write =<BR>> >> librari=3D<BR>> >>>> es with the desired interface=3D2C and so many languages don't let =<BR>> >> infix oper=3D<BR>> >>>> ators be in a user-written library.<BR>> >>>> =20<BR>> >>>> (There is a subtle but useless distinction here -- infix operators =<BR>> >> being in=3D<BR>> >>>> libraries vs. "user-written" libraries. The infix set operations for =<BR>> >> examp=3D<BR>> >>>> le are in a library=3D2C but not user-written=3D2C special=3D2C the =<BR>> >> compiler know=3D<BR>> >>>> s about it.)<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>>> that would perhaps not match how C handles "long long" on the same<BR>> >>>>> platform (which is how=3D2C come to think of it?)=3D2C and that =<BR>> >> would require<BR>> >>>> =20<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> On NT/x86=3D2C __int64/long long is returned in the register pair =<BR>> >> edx:eax.<BR>> >>>> =20<BR>> >>>> edx is high=3D2C eax is low.<BR>> >>>> =20<BR>> >>>> When passed as a parameter to __stdcall or __cdecl is just passed as =<BR>> >> two 32=3D<BR>> >>>> bit values adjacent on the stack=3D2C "hi=3D2C lo=3D2C hi=3D2C lo=3D2C =<BR>> >> it's off to pu=3D<BR>> >>> sh we go" is the Snow White-influenced mantra to remember how to pass =<BR>> >> them=3D<BR>> >>>> =3D2C at least on little endian stack-growing-down machines (which =<BR>> >> includes x=3D<BR>> >>>> 86). For __fastcall I'm not sure they are passed in registers or on =<BR>> >> the sta=3D<BR>> >>>> ck.<BR>> >>>> =20<BR>> >>>> Passing and/or returning small structs also has special efficient =<BR>> >> handling =3D<BR>> >>>> in the ABI=3D2C so __int64 really might be equivalent to a small =<BR>> >> record. Not =3D<BR>> >>>> that cm3 necessarily implements that "correctly" -- for interop with =<BR>> >> C=3D3B =3D<BR>> >>>> for Modula-3 calling Modula-3 we can make up our own ABI so there =<BR>> >> isn't rea=3D<BR>> >>>> lly an "incorrect" way. Notice the mingw problem I had passing a =<BR>> >> Win32 poin=3D<BR>> >>>> t struct by value=3D2C I cheated and passed it by VAR to a C wrapper =<BR>> >> to worka=3D<BR>> >>>> round the gcc backend bug (which was mentioned a few times and which =<BR>> >> I look=3D<BR>> >>>> ed into the code for=3D2C but took the easy route)<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> I don't know how long long works on other platforms but probably =<BR>> >> similar.<BR>> >>>> =20<BR>> >>>> Probably a certain register pair for return values.<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>> =20<BR>> >>>> - Jay<BR>> >>>> =20<BR>> >>>> =3D20<BR>> >>>>> To: hosking@cs.purdue.edu<BR>> >>>>> Date: Sat=3D2C 17 Apr 2010 19:47:03 -0700<BR>> >>>>> From: mika@async.async.caltech.edu<BR>> >>>>> CC: m3devel@elegosoft.com<BR>> >>>>> Subject: Re: [M3devel] INTEGER<BR>> >>>>> =3D20<BR>> >>>>> Tony Hosking writes:<BR>> >>>>>> =20<BR>> >>>>> ...<BR>> >>>>>> =20<BR>> >>>>>>> We need it to match 64-bit integers on 32-bit machines? That seems =<BR>> >> =3D3D<BR>> >>>>>> like<BR>> >>>>>>> a very weak rationale indeed=3D2C if the same functionality could =<BR>> >> be =3D3D<BR>> >>>>>> provided<BR>> >>>>>>> through some other mechanism (e.g.=3D2C ARRAY [0..1] OF =<BR>> >> INTEGER---even =3D<BR>> >>>> =3D3D<BR>> >>>>>> with<BR>> >>>>>>> a pragma e.g. <*CLONGLONG*>.. if it is necessary to tell the =<BR>> >> compiler =3D<BR>> >>>> =3D3D<BR>> >>>>>> that<BR>> >>>>>>> a special linkage convention is needed).<BR>> >>>>>> =20<BR>> >>>>>> There's no special linkage convention. Not sure what you mean here.<BR>> >>>>>> =20<BR>> >>>>> =3D20<BR>> >>>>> I just mean if we had<BR>> >>>>> =3D20<BR>> >>>>> TYPE LONGINT =3D3D ARRAY [0..1] OF INTEGER<BR>> >>>>> =3D20<BR>> >>>>> that would perhaps not match how C handles "long long" on the same<BR>> >>>>> platform (which is how=3D2C come to think of it?)=3D2C and that =<BR>> >> would require<BR>> >>>>> special linkage tricks.<BR>> >>>>> =3D20<BR>> >>>>> But what would be lost? The ability to type literals.=3D20<BR>> >>>>> =3D20<BR>> >>>>> You could get the same code interface on 32- and 64-bit machine by<BR>> >>>>> defining<BR>> >>>>> =3D20<BR>> >>>>> TYPE FileOffset =3D3D ARRAY[0..1] OF [-16_80000000 .. +16_7fffffff ]<BR>> >>>>> =3D20<BR>> >>>>> and using that.<BR>> >>>>> =3D20<BR>> >>>>> =3D20<BR>> >>>>> Mika<BR>> >>>> =3D<BR>> >>>> =20<BR>> >>>> --_264cb69b-0215-44c3-807c-8b4d8ea0ea59_<BR>> >>>> Content-Type: text/html; charset=3D"iso-8859-1"<BR>> >>>> Content-Transfer-Encoding: quoted-printable<BR>> >>>> =20<BR>> >>>> <html><BR>> >>>> <head><BR>> >>>> <style><!--<BR>> >>>> .hmmessage P<BR>> >>>> {<BR>> >>>> margin:0px=3D3B<BR>> >>>> padding:0px<BR>> >>>> }<BR>> >>>> body.hmmessage<BR>> >>>> {<BR>> >>>> font-size: 10pt=3D3B<BR>> >>>> font-family:Verdana<BR>> >>>> }<BR>> >>>> --></style><BR>> >>>> </head><BR>> >>>> <body class=3D3D'hmmessage'><BR>> >>>> TYPE LONGINT =3D3D ARRAY [0..1] OF INTEGER on a =3D3B32bit system =<BR>> >> is very c=3D<BR>> >>>> lose to LONGINT.<BR><BR>> >>>>  =3D3BPlus treating it opaquely and providing a bunch of =<BR>> >> functions to ope=3D<BR>> >>>> rate on it.<BR><BR>> >>>>  =3D3BJust as well therefore could be RECORD hi=3D2Clo:LONGINT =<BR>> >> END (see LAR=3D<BR>> >>>> GE_INTEGER and ULARGE_INTEGER in winnt.h)<BR><BR>> >>>>  =3D3B<BR><BR>> >>>> Differences that come to mind:<BR><BR>> >>>>  =3D3B =3D3Binfix operators =3D3B <=3D3B=3D3D=3D3D=3D3D =<BR>> >> <BR><BR>> >>>>  =3D3B possibly passed differently =3D3Bas a parameter<BR><BR>> >>>>  =3D3B or returned differently as a result<BR><BR>> >>>>  =3D3B ie. probably "directly compatible with" "long long"=3D2C =<BR>> >> passed by v=3D<BR>> >>>> alue (of course you could always pass by pointer and achieve =<BR>> >> compatibilitit=3D<BR>> >>>> y trivially)<BR><BR>> >>>>  =3D3B<BR><BR>> >>>>  =3D3B<BR><BR>> >>>> I have to say though=3D2C the biggest reason is in-fix operators. =<BR>> >> Convenient =3D<BR>> >>>> syntax.<BR><BR>> >>>> C++ is the best and some way worst of example of the general right =<BR>> >> way to d=3D<BR>> >>>> o this -- you let programmers define types and their infix operators. =<BR>> >> Other=3D<BR>> >>>> languages just come with a passle of special cases of types that have =<BR>> >> in-f=3D<BR>> >>>> ix operators.<BR><BR>> >>>> A good example is that Java infix operator + on string=3D2C besides =<BR>> >> the vario=3D<BR>> >>>> us integers=3D2C and nothing else.<BR><BR>> >>>>  =3D3B<BR><BR>> >>>>  =3D3B<BR><BR>> >>>> I think C# lets you define operators=3D2C yet people don't complain =<BR>> >> that it i=3D<BR>> >>>> s "a mess" as they do of C++.<BR><BR>> >>>> I think Python does now too.<BR><BR>> >>>> So it is feature growing in popularity among "mainstream" =<BR>> >> languages=3D2C not =3D<BR>> >>>> just C++.<BR><BR>> >>>>  =3D3B =3D3B C++ of course is extremely mainstream=3D2C but =<BR>> >> also a favori=3D<BR>> >>>> te target. (<A =<BR>> >> href=3D3D"http://www.relisoft.com/tools/CppCritic.html">http:/=3D<BR>> >>>> /www.relisoft.com/tools/CppCritic.html</A>)<BR><BR>> >>>>  =3D3B<BR><BR>> >>>>  =3D3B<BR><BR>> >>>> We also have subranges of LONGINT.<BR><BR>> >>>> I'm not sure what the generalization of subranges are=3D2C =<BR>> >> granted.<BR><BR>> >>>>  =3D3BMaybe some sort of C++ template that takes constants in the =<BR>> >> templat=3D<BR>> >>>> e and does range checks at runtime. Yeah=3D2C maybe.<BR><BR>> >>>>  =3D3B<BR><BR>> >>>>  =3D3B<BR><BR>> >>>> And as you point out=3D2C convenient literal syntax.<BR><BR>> >>>>  =3D3B<BR><BR>> >>>>  =3D3B<BR><BR>> >>>> People reasonably argue for library extension in place of language =<BR>> >> extensio=3D<BR>> >>>> n=3D2C but that requires a language which is flexible enough to write =<BR>> >> librari=3D<BR>> >>>> es with the desired interface=3D2C and so many languages don't let =<BR>> >> infix oper=3D<BR>> >>>> ators be in a user-written library.<BR><BR>> >>>> (There is a subtle but useless distinction here -- infix operators =<BR>> >> being in=3D<BR>> >>>> libraries vs. "user-written" libraries. The infix set operations for =<BR>> >> examp=3D<BR>> >>>> le are in a library=3D2C but not user-written=3D2C special=3D2C the =<BR>> >> compiler know=3D<BR>> >>>> s about it.)<BR><BR>> >>>>  =3D3B<BR><BR>> >>>> >=3D3B that would perhaps not match how C handles "long long" on =<BR>> >> the same<B=3D<BR>> >>>> R>>=3D3B platform (which is how=3D2C come to think of it?)=3D2C and =<BR>> >> that would =3D<BR>> >>>> require<BR><BR><BR>> >>>>  =3D3B<BR><BR>> >>>> On NT/x86=3D2C __int64/long long is returned in the register pair =<BR>> >> edx:eax.<BR=3D<BR>> >>>>> =20<BR>> >>>> edx is high=3D2C eax is low.<BR><BR>> >>>> When passed as a parameter to __stdcall or __cdecl is just passed as =<BR>> >> two 32=3D<BR>> >>>> bit values adjacent on the stack=3D2C "hi=3D2C lo=3D2C hi=3D2C lo=3D2C =<BR>> >> it's off to pu=3D<BR>> >>>> sh we go" is the Snow White-influenced mantra to remember how to pass =<BR>> >> them=3D<BR>> >>>> =3D2C at least on little endian stack-growing-down machines (which =<BR>> >> includes x=3D<BR>> >>>> 86). For __fastcall I'm not sure they are passed in registers or on =<BR>> >> the sta=3D<BR>> >>>> ck.<BR><BR>> >>>> Passing and/or returning small structs also has special efficient =<BR>> >> handling =3D<BR>> >>>> in the ABI=3D2C so __int64 really might be equivalent to a small =<BR>> >> record. Not =3D<BR>> >>>> that cm3 necessarily implements that "correctly" =3D3B -- for =<BR>> >> interop wit=3D<BR>> >>>> h C=3D3B for Modula-3 calling Modula-3 we can make up our own ABI so =<BR>> >> there is=3D<BR>> >>>> n't =3D3Breally an "incorrect" way. =3D3BNotice the mingw =<BR>> >> problem I had=3D<BR>> >>>> passing a Win32 point struct by value=3D2C I cheated and passed it by =<BR>> >> VAR to=3D<BR>> >>>> a =3D3BC wrapper to workaround the gcc backend bug (which was =<BR>> >> mentioned =3D<BR>> >>>> a few times and which I looked into the code for=3D2C but took the =<BR>> >> easy route=3D<BR>> >>>> )<BR><BR>> >>>>  =3D3B<BR><BR>> >>>>  =3D3B<BR><BR>> >>>> I don't know how long long works on other platforms but probably =<BR>> >> similar.<B=3D<BR>> >>>> R><BR>> >>>> Probably a certain register pair for return values.<BR><BR>> >>>>  =3D3B<BR><BR>> >>>>  =3D3B- Jay<BR><BR> =3D3B<BR>>=3D3B To: =<BR>> >> hosking@cs.purdue.edu<BR>>=3D3B=3D<BR>> >>>> Date: Sat=3D2C 17 Apr 2010 19:47:03 -0700<BR>>=3D3B From: =<BR>> >> mika@async.async.c=3D<BR>> >>>> altech.edu<BR>>=3D3B CC: m3devel@elegosoft.com<BR>>=3D3B Subject: =<BR>> >> Re: [M3de=3D<BR>> >>>> vel] INTEGER<BR>>=3D3B <BR>>=3D3B Tony Hosking writes:<BR>>=3D3B =<BR>> >> >=3D3B<BR>=3D<BR>> >>>> >=3D3B ...<BR>>=3D3B >=3D3B<BR>>=3D3B >=3D3B>=3D3B We =<BR>> >> need it to match 64-b=3D<BR>> >>>> it integers on 32-bit machines? That seems =3D3D<BR>>=3D3B =<BR>> >> >=3D3Blike<BR>>=3D<BR>> >>>> =3D3B >=3D3B>=3D3B a very weak rationale indeed=3D2C if the same =<BR>> >> functionality =3D<BR>> >>>> could be =3D3D<BR>>=3D3B >=3D3Bprovided<BR>>=3D3B >=3D3B>=3D3=<BR>> >> B through some o=3D<BR>> >>>> ther mechanism (e.g.=3D2C ARRAY [0..1] OF INTEGER---even =<BR>> >> =3D3D<BR>>=3D3B >=3D3B=3D<BR>> >>>> with<BR>>=3D3B >=3D3B>=3D3B a pragma e.g. =<BR>> >> <=3D3B*CLONGLONG*>=3D3B.. if it i=3D<BR>> >>>> s necessary to tell the compiler =3D3D<BR>>=3D3B =<BR>> >> >=3D3Bthat<BR>>=3D3B >=3D3B&=3D<BR>> >>>> gt=3D3B a special linkage convention is needed).<BR>>=3D3B =<BR>> >> >=3D3B<BR>>=3D3B &=3D<BR>> >>>> gt=3D3BThere's no special linkage convention. Not sure what you mean =<BR>> >> here.<BR=3D<BR>> >>>>> >=3D3B >=3D3B<BR>>=3D3B <BR>>=3D3B I just mean if we =<BR>> >> had<BR>>=3D3B <BR>>=3D<BR>> >>>> =3D3B TYPE LONGINT =3D3D ARRAY [0..1] OF INTEGER<BR>>=3D3B =<BR>> >> <BR>>=3D3B that woul=3D<BR>> >>>> d perhaps not match how C handles "long long" on the same<BR>>=3D3B =<BR>> >> platfor=3D<BR>> >>>> m (which is how=3D2C come to think of it?)=3D2C and that would =<BR>> >> require<BR>>=3D<BR>> >>>> =3D3B special linkage tricks.<BR>>=3D3B <BR>>=3D3B But what would =<BR>> >> be lost? Th=3D<BR>> >>>> e ability to type literals. <BR>>=3D3B <BR>>=3D3B You could get =<BR>> >> the same co=3D<BR>> >>>> de interface on 32- and 64-bit machine by<BR>>=3D3B =<BR>> >> defining<BR>>=3D3B <BR>=3D<BR>> >>>> >=3D3B TYPE FileOffset =3D3D ARRAY[0..1] OF [-16_80000000 .. =<BR>> >> +16_7fffffff ]<B=3D<BR>> >>>> R>>=3D3B <BR>>=3D3B and using that.<BR>>=3D3B <BR>>=3D3B =<BR>> >> <BR>>=3D3B Mika<BR=3D<BR>> >>>>> </body><BR>> >>>> </html>=3D<BR>> >>>> =20<BR>> >>>> --_264cb69b-0215-44c3-807c-8b4d8ea0ea59_--<BR>> <BR> </body>
</html>