Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] More OCaml+windowing system questions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Wolfgang Lux <lux@w...>
Subject: Re: [Caml-list] More OCaml+windowing system questions
"Warp" wrote

> I think that all the features of the C/C++ languages ARE portable. Why
> shouldn't they be ? All you have to do is to compile with the good compiler

Because they are machine dependent by definition. For example the C standards 
have nothing to say about the size of an int or a short (except that 
sizeof(int) >= sizeof(short)). Depending on the architecture, compiler, and 
even programming model, int i = 1; i <<= 32; will either set i to 0 or to 
0x100000000 (even for gcc). Neither can you rely on the order of bytes in an 
integer (and casting an int* into a char* is certainly not forbidden by the 
standard) etc.

> ( gcc for instance ). BUT then, you have to be aware of some things that are
> not permitted ( like DWORD access on odd memory addresses on Solaris ) and
> to use a portable API - like ACE, or OpenGL - to do "special" things. In
> fact, the limits of portability C/C++ are in the choice of the API you make,
> and in the fact you CAN write very-low-level code when you should use an
> API.

No one is claiming that you cannot write portable code in C, you just have to 
take care and restrict yourself to the portable subset of C (or resort to some 
preprocessor magic in order to adapt to different platforms.)

Wolfgang



--
Wolfgang Lux				  Phone: +49-251-83-38263
Institut fuer Wirtschaftinformatik	    FAX: +49-251-83-38259
Universitaet Muenster		      Email: wlux@uni-muenster.de
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr