Re: Java ME or SE?
On 11/10/2014 7:37 PM, Martin Gregorie wrote:
On Mon, 10 Nov 2014 23:51:48 +0100, Kees Theunissen wrote:
Martin Gregorie wrote:
A modern C compiler can compile any C program that was written in the
past, including those using the original K&R syntax.
Well, no: It won't *always* compile.
#include <strings.h> /* <string.h> nowadays */
#include <malloc.h> /* <stdarg.h> nowadays, sort of */
#include <varargs.h>
/* ... and the not-quite-compatible consequents thereof */
#include <stdio.h>
...
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