Java ME or SE?

Well, no: It won't *always* compile.

#include /* nowadays */

#include /* nowadays, sort of */

#include /* ... and the not-quite-compatible consequents thereof */

#include ... char *p = sprintf(...); /* worked in some old C's, not today */

enum permissiveness { allow, forbid, restrict };

enum roller_skate_type { side_by_side, inline };

processTransaction(tptr, void) Transaction *tptr; /* the transaction to process */ int void; /* flag: true to void the transaction */ { ... }

extern char *malloc(); ... float matrix = (float*) malloc(rows * cols * sizeof(float)); /* This one's moderately subtle, but potentially fatal because * although it may well compile, thus not providing a reliable * counter-example to your assertion, it can misbehave badly. */

unsigned short this = 42; int that = -42; int those = this * that; /* Another "It compiles" example, where "It compiles" is of * little comfort. Modern C gives -1764 as the result, while * some old C's gave 4294965532 or 63772. Again, a case where * "It compiles" simply isn't good enough: "It compiles," but * to something not intended by the author. */

Java's a lot cleaner than C in this respect (given its shorter history, it ought to be), but still not quite perfect. Consider a pre-1.4 source using `assert' as an identifier, or a pre-1.2 source with a method named `strictfp'. Change is the only constant.

--
esosman@comcast-dot-net.invalid 
"Don't be afraid of work. Make work afraid of you." -- TLM
Reply to
Eric Sosman
Loading thread data ...

Um, er,

#include /* nowadays, sort of */

... sort of.

--
esosman@comcast-dot-net.invalid 
"Don't be afraid of work. Make work afraid of you." -- TLM
Reply to
Eric Sosman

You can usually fix that with some switches. All the c code I wrote in the 1980s compile, link and rund Just Fine on modern Linux, BSD and even QNX/Posix systems.

Even the Fortran code I entered for the 1130 on punched cards in the 1970s will run with some slight preambles in the code.

-- mrr

Reply to
Morten Reistad

Python 2.x code run a python 2.x interpreter. seeing as both 2.78 & 3.0 are available for windows & moth Linux's come with V2.7 as the default system python I don't see this a fundamentally difficult option.

if you have a large 2.x code base then you should probably stick with it anyway, Reserving 3.0 for "Green Field" projects.

--
No character, however upright, is a match for constantly reiterated  
attacks, 
 Click to see the full signature
Reply to
alister

Example please.

Reply to
mm0fmf

Off the top of my head, I don't think the K&R era standard library's IPC functions were much like the SVR4 IPC functions, which are pretty damn good and easy to use, so writing a shim that presented the equivalent K&R API to the program and called one of more SVR4 functions to do the same job may be a lot easier than finding and modifying all the calls in a large, minimally commented program.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie

Another good example would be using shims to let a program using non-POSIX threaded program use POSIX threading.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie

You said "Python and other languages whose compilers aren't backward compatible".

Give an example of some Python that is not backwards compatible.

Reply to
mm0fmf

Python 2 source fed to a Python 3 compiler.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie

On 12/11/2014 00:53, Martin Gregorie wrote: > On Tue, 11 Nov 2014 22:15:09 +0000, mm0fmf wrote: >> Give an example of some Python that is not backwards compatible. >> > Python 2 source fed to a Python 3 compiler. > Its more useful to think of Python 2 and Python 3 different languages as C & C++ are. Just like with C & C++ both Python 2 and Python 3 receive ongoing support.

As both Python 2 and Python 3 are in all major distro's for the Raspberry Pi, that is the only relevance to this newsgroup. If you want to continue the discussion, please take it to comp.lang.python

---druck

Reply to
druck

It's not a compiler, it's an interpeter (though I agree the distinction is becoming blurred nowadays.

However, more to the point, well written Python 2 code will mostly run without problems in Python 3. It's pretty easy to write code that works in both.

--
Chris Green
Reply to
cl

Reply to
Gordon Levi

I see there is a Python 2 to Python 3 converter. How useful is it?

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
 Click to see the full signature
Reply to
Martin Gregorie

It works fine, but you may still need to do some manual tweaks, depending on how (badly) your python 2 code has been written.

Reply to
Tony van der Hoff

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.