G
Gordon Beaton
What is C89 and C99?
Common names of two C programming language standards:
C89: ANSI X3.159-1989
C99: ISO/IEC 9899:1999
/gordon
--
What is C89 and C99?
[comp.lang.java.programmer] Bent C Dalager said:Java applications don't return anything at the end of main() - Java
applications return something when the application terminates. This
may be weeks after main() ended.
Unless forced to do otherwise, a Java application terminates when its
last non-daemon thread ends. If that thread ends normally (i.e. it
doesn't explicitly call System.exit(), Runtime.exit() or
Runtime.halt() but just runs to completion) then the app will
presumably return the "ok" value for the OS it runs on (normally 0).
[comp.lang.java.programmer] Thomas Kellerer said:Christopher Benson-Manica, 15.10.2007 21:05:C89 says that the status is unspecified if the return from main() is
omitted; C99 implicitly returns a status indicating "successful".
What is C89 and C99?
Christopher said:I would also "presume" that the application would return the
"successful" return value in that circumstance, but I'm specifically
wondering whether the JLS or something else that's relevant specifies
the behavior.
Christopher said:They are both particular versions of the ISO C specification, named
for the years in which they were adopted. I mentioned them in the
hope that someone would quote an equally authoritative Java source
with some information regarding my question.
Joshua said:Christopher said:I would also "presume" that the application would return the
"successful" return value in that circumstance, but I'm specifically
wondering whether the JLS or something else that's relevant specifies
the behavior.
JLS 3 §12 (Execution) is the relevant section. About the only thing it
says about the main method is that its signature must be `public static
void main(String[] args)' (using a vararg method is also permissible),
that it is invoked, and this portion at the end:
§12.8 Program Exit
A program terminates all its activity and exits when one of two things
happens:
* All the threads that are not daemon threads terminate.
* Some thread invokes the exit method of class Runtime or class
System and the exit operation is not forbidden by the security manager.
Nothing at all is made mention of return codes or anything similar. I
could write a JVM that always returned 42 and it would still conform to
the JLS.
[comp.lang.java.programmer] Lew said:The JLS doesn't say anything about an exit value from the JVM.
Neither does the JVM spec:
<http://java.sun.com/docs/books/jvms/second_edition/html/Concepts.doc.html#19152>
Christopher said:Given that, is a conforming Java implementation free to return
whatever value it likes to the execution environment following the
termination of the JVM? That doesn't strike me as an especially
appealing situation.
[comp.lang.java.programmer] Patricia Shanahan said:I think the place this SHOULD be documented, and is not, is in the tool
documentation. For example, java-on-Solaris is a Solaris command, and
its documentation should specify its exit codes.
The JLS and JVM spec cannot even assume the implementation can return a
code to its environment.
Christopher said:[comp.lang.java.programmer] Patricia Shanahan said:I think the place this SHOULD be documented, and is not, is in the tool
documentation. For example, java-on-Solaris is a Solaris command, and
its documentation should specify its exit codes.
That would be reasonable, however...
The JLS and JVM spec cannot even assume the implementation can return a
code to its environment.
...I feel that Java could have navigated that situation in a way
similar to the way that C has. ... Given
that this is probably what occurs already without exception in all
host environments that expect a return code, it seems like formalizing
this convention wouldn't place any undue stress on any implementation
authors.
Obviously, this specification would only apply to "normal"
termination, not inherently system-specific situations such as an
uncaught runtime exception.
(Sorry to get long-winded there.)
Thomas said:Christopher Benson-Manica, 15.10.2007 21:05:What is C89 and C99?[comp.lang.java.programmer] Thomas Kellerer
In java you use System.exit(int) to return a status value to the OS
C89 says that the status is unspecified if the return from main() is
omitted; C99 implicitly returns a status indicating "successful".
What status does a Java program return to the host environment at the
end of main()? Is it specified?
If SUN followed that standard Java 1.5 would be Java 2004 and 1.6
would be Java 2006.
The tradition in ANSI/ISO is to name the standards for
programming languages after the year the standard was
completed.
Fortran 66, Fortran 77, Fortran 90, Ada 83, Ada 95 etc..
Andy said:The tradition in ANSI/ISO is to name the standards for
programming languages after the year the standard was
completed.Fortran [sic] 66, Fortran 77, Fortran 90, Ada 83, Ada 95 etc..
What are they going to do when Fortran [sic] wraps around the century?
What are they going to do when Fortran wraps around the century?
I think that would be a great idea. You would have more luck mixing
software from the same vintage. You could tell what software likely
needed an upgrade.
I find it amusing when people have version numbers with 4 decimal
places. What is this fear of incrementing?
Eric said:This in turn suggests an attitude toward programming: Don't
write any code until you've finished defining the problem.
Hard advice for eager beavers like me to follow, unwelcome
advice for people who enjoy words like "agile" and "mash-up,"
but advice one would do well to ponder prior to rejecting.
[...]
Furthermore, "define completely up front" (a.k.a., "Waterfall") has been
proven a) not to work, and b) never to happen in real life.
Eric said:Lew wrote On 11/05/07 17:24,:[...]
Furthermore, "define completely up front" (a.k.a., "Waterfall") has been
proven a) not to work, and b) never to happen in real life.
Well, I *did* say the advice was hard to follow!
Still, "proven not to work" and "proven never to happen"
sound like overstatements. The counter-example, again, is
Knuth: How many "agile" developers hand out exponentially-
growing monetary rewards to people who find bugs in their
programs? Knuth does: he is offering $327.68 for the next
We ordinary mortals may be unable to reach Knuth's high
standards, but his results speak for themselves -- and if
an ordinary mortal sniffs at the "proven not to work" methods
that produce results so much better than his own, he does so
at some risk of ridicule.
Andy said:What are they going to do when Fortran wraps around the century?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.