I've read that as well as "normal" Java-like function definitions,
e.g. int main(int argc, char **argv), you can also choose to use an
alternative syntax, i.e.
int main(argc, argv)
int argc; char **argv;
{
....
}
I've been struggling to think of a situation where this alternative
form is more expressive than the usual one, but I guess I'm just not
imaginative enough :)
When do people prefer the alternative way, and why? 11 2257 Fr************@googlemail.com wrote:
I've read that as well as "normal" Java-like function definitions,
e.g. int main(int argc, char **argv), you can also choose to use an
alternative syntax, i.e.
There's nothing Java like about them, they are standard C.
int main(argc, argv)
int argc; char **argv;
{
....
}
I've been struggling to think of a situation where this alternative
form is more expressive than the usual one, but I guess I'm just not
imaginative enough :)
When do people prefer the alternative way, and why?
Never, it's an obsolete form that pre-dates C89.
--
Ian Collins.
>I've read that as well as "normal" Java-like function definitions,
Java has nothing to do with it.
>e.g. int main(int argc, char **argv), you can also choose to use an alternative syntax, i.e.
int main(argc, argv)
int argc; char **argv; { ... }
I've been struggling to think of a situation where this alternative form is more expressive than the usual one, but I guess I'm just not imaginative enough :)
It's not. The main use of this form is for obsolete compilers that
don't accept the ANSI C function syntax. I know of one specific
one from 1983 that I've still got, but haven't used in over a decade.
>When do people prefer the alternative way, and why?
Hopefully never for new code on modern hardware. They might prefer
it if the only compiler available (at least for reasonable budgets)
accepts this form, and does not accept the ANSI C form. This would
tend to be mostly for "abandoned" processors. Another reason would
be to avoid doing massive changes to legacy code for what is maybe
supposed to be a minor change.
On 10 Mar 2007 14:33:23 -0800, in comp.lang.c , Fr************@googlemail.com wrote:
>I've read that as well as "normal" Java-like function definitions, e.g. int main(int argc, char **argv),
Giggle. If anything, Java stole this style from C. Call it C-like...
>you can also choose to use an alternative syntax, i.e.
int main(argc, argv)
int argc; char **argv;
This is an older, deprecated, pre ISO style dating back to the 1980s.
Don't use it.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Mark McIntyre wrote:
On 10 Mar 2007 14:33:23 -0800, in comp.lang.c , Fr************@googlemail.com wrote:
>I've read that as well as "normal" Java-like function definitions, e.g. int main(int argc, char **argv),
Giggle. If anything, Java stole this style from C. Call it C-like...
But C stole it from C++ ...
(Or: For all the bad things one can say about That Other
Language, it has in fact produced a few improvements.)
--
Eric Sosman es*****@acm-dot-org.invalid Fr************@googlemail.com wrote:
I've read that as well as "normal" Java-like function definitions,
e.g. int main(int argc, char **argv),
This has nothing to do with Java. It was introduced to C, in the 1989
ANSI Standard, from C++. Java later on adopted it.
you can also choose to use an
alternative syntax, i.e.
int main(argc, argv)
int argc; char **argv;
{
...
}
I've been struggling to think of a situation where this alternative
form is more expressive than the usual one, but I guess I'm just not
imaginative enough :)
When do people prefer the alternative way, and why?
This is the older pre-C89 style of function declarations. It was
popularised by K&R 1 and was used in the 70s and mid-80s. One of the
major changes that the 1989 C Standard introduced was the newer type
of function declaration and definition, mainly to help compilers
perform stricter argument checking. The old form has been obsolete
ever since, though it's still syntactically accepted, because a lot of
old code uses it. Don't use it, except as an academic exercise. Use
the newer prototyped style. It's much better in terms of self-
documentation and, more importantly, allows the compiler to do
validation of arguments and cross-checking between declaration and
usage.
Thanks to everyone for the clarifications.
Gordon Burditt wrote:
>
I've read that as well as "normal" Java-like function definitions,
Java has nothing to do with it.
e.g. int main(int argc, char **argv), you can also choose to use an
alternative syntax, i.e.
int main(argc, argv)
int argc; char **argv;
[...]
The main use of this form is for obsolete compilers that
don't accept the ANSI C function syntax. I know of one specific
one from 1983 that I've still got, but haven't used in over a decade.
[...]
The last time I used an HP-UX system (post-2000), it would not
accept such syntax, chosing instead to give an error that it did
not support "ANSI prototypes".
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
In article <45***************@spamcop.net>,
Kenneth Brody <ke******@spamcop.netwrote:
....
>The last time I used an HP-UX system (post-2000), it would not accept such syntax, chosing instead to give an error that it did not support "ANSI prototypes".
The "built-in"/default C compiler on HP/UX (at least when I worked on
it, which was last century) is very antedeluvian. It seems to be like
Sun, where the defaults are the very oldest versions of everything. You
have to use C89 (or something like that) to get the newfangled stuff.
Or some other C compiler, like gcc or such...
On Tue, 13 Mar 2007 11:58:21 -0400, Kenneth Brody
<ke******@spamcop.netwrote:
>Gordon Burditt wrote:
>>
>I've read that as well as "normal" Java-like function definitions,
Java has nothing to do with it.
>e.g. int main(int argc, char **argv), you can also choose to use an alternative syntax, i.e.
int main(argc, argv)
int argc; char **argv;
[...]
>The main use of this form is for obsolete compilers that don't accept the ANSI C function syntax. I know of one specific one from 1983 that I've still got, but haven't used in over a decade.
[...]
The last time I used an HP-UX system (post-2000), it would not accept such syntax, chosing instead to give an error that it did not support "ANSI prototypes".
I suspect you were using the wrong compile options.
--
Al Balmer
Sun City, AZ
Al Balmer wrote:
>
On Tue, 13 Mar 2007 11:58:21 -0400, Kenneth Brody
<ke******@spamcop.netwrote:
Gordon Burditt wrote:
[...]
The main use of this form is for obsolete compilers that
don't accept the ANSI C function syntax. I know of one specific
one from 1983 that I've still got, but haven't used in over a decade.
[...]
The last time I used an HP-UX system (post-2000), it would not
accept such syntax, chosing instead to give an error that it did
not support "ANSI prototypes".
I suspect you were using the wrong compile options.
Nope. I researched it and found that the standard compiler supplied
by HP simply did not support this You had to buy a more expensive
version if you wanted that ability.
What got me about it was that they coded the recognition of the ANSI
style, and told you that it didn't support it. (Though I guess doing
it this way is a step up from just flagging some error. At least
this way, you don't waste time trying to track down your "error".)
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
On Tue, 13 Mar 2007 14:40:10 -0400, Kenneth Brody
<ke******@spamcop.netwrote:
>Al Balmer wrote:
>> On Tue, 13 Mar 2007 11:58:21 -0400, Kenneth Brody <ke******@spamcop.netwrote:
>Gordon Burditt wrote:
[...]
>The main use of this form is for obsolete compilers that don't accept the ANSI C function syntax. I know of one specific one from 1983 that I've still got, but haven't used in over a decade. [...]
The last time I used an HP-UX system (post-2000), it would not accept such syntax, chosing instead to give an error that it did not support "ANSI prototypes".
I suspect you were using the wrong compile options.
Nope. I researched it and found that the standard compiler supplied by HP simply did not support this You had to buy a more expensive version if you wanted that ability.
Ah, *that* one. That's used for some kind of maintenance activity and
not really intended for program development. You don't expect anything
useful without paying extra, do you? <g>.
> What got me about it was that they coded the recognition of the ANSI style, and told you that it didn't support it. (Though I guess doing it this way is a step up from just flagging some error. At least this way, you don't waste time trying to track down your "error".)
I suspect that the compiler shipped with HP-UX is a gutted version of
the standard one, so it probably retains warnings. The current (extra
cost) version of the PA-RISC compiler is actually pretty good. I
haven't seen a conformance statement, but it seems to support most of
C99. The Itanium compiler must have been a big development effort,
since it has to do all the optimizations that used to be in the
hardware. I haven't used it, since we've managed to make our product
run well under the Aries emulator.
--
Al Balmer
Sun City, AZ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Henry Ludemann |
last post by:
I've been writing an optparse alternative (using getopt) that is at a
stage where I'd be interested in people's opinions. It allows you to
easily creating command line interfaces to existing...
|
by: Neal |
last post by:
Of course, every frame site I've ever seen has reduced usability and all.
We've been through this before.
But as frameset is still a part of HTML, there must be some legitimate use
for it, hmm?...
|
by: Tammy |
last post by:
What would be a good alternative to using frames? I need something
that will section my webpage into two halves and can change both
frames on a single click.
Thanks in Advance,
Tammy
|
by: Simon Shutter |
last post by:
Forgive me if I am posting to wrong newsgroup and for a couple of loaded
questions.
First, from what I understand, one of the advantages of XHTML/CSS is the
ability of screen readers/braille...
|
by: anonymous |
last post by:
Thanks your reply.
The article I read is from
www.hakin9.org/en/attachments/stackoverflow_en.pdf.
And you're right. I don't know it very clearly. And that's why I want
to understand it; for it's...
|
by: Alan Silver |
last post by:
Hello,
I understand the issue that tables should be used for tabular data and
not for layout, but I would like some clarification as to exactly what
constitutes tabular data.
For example, if...
|
by: Cuthbert |
last post by:
After compiling the source code with gcc v.4.1.1, I got a warning
message:
"/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the
'gets' function is dangerous and should not be...
|
by: Jess |
last post by:
Hello,
Sometimes declarations are all what we need when we define/declare
classes (or functions?), but sometimes we need definitions. I learned
that if we define a class (B) that has an object...
|
by: Rick Giuly |
last post by:
Hello All,
Why is python designed so that b and c (according to code below)
actually share the same list object? It seems more natural to me that
each object would be created with a new list...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |