Re: passing a string to a C++ function

Hi Igor,

I disagree. When I used to write in "C" I used this form all the time and
it seemed to make perfect sense (before prototypes). When you write it this
way you can do things like:

int f(x,y)
int x; /* first input value */
int y; /* second input value */
return (x+y);

Like so many things in the religion of programming there are lots of ways to
do the same thing and lots of reasons to use the ways.


"Igor Tandetnik" <itandetnik@xxxxxxxx> wrote in message
> "Lawrence Groves" <lgroves@xxxxxxxxxxxxxxxxx> wrote in message
> news:OSKlWAzzFHA.3660@xxxxxxxxxxxxxxxxxxxx
>> "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx> wrote in message
>> news:uk9PrpOzFHA.2960@xxxxxxxxxxxxxxxxxxxxxxx
>>> Unfortunately, K&R style is in general horrible. There is nothing
>>> wrong with this particular line, but you should not take their code
>>> as example.
>> I don't agree. Before C++ came along it was the defacto standard. How
>> can you say they have bad style or are no good for examples? They
>> invented the language so who better to follow?
> The original K&R style looks like this:
> int f(x, y)
> int x;
> int y;
> {
> return x + y;
> }
> Nobody in their right mind, including C programmers, writes code like that
> nowadays. This style was considered horrible well before C++ was invented.


Relevant Pages

  • Re: Portability: Harmony between PC and microcontroller
    ... int is the natural integer type for the system. ... You are, perhaps unintentionally, paraphrasing the standard in a way ... One of the things that you might not realize is that the C programming ... In the real world, most embedded systems have more complex jobs to do, ...
  • Re: What will be the next MAJOR programming language for commercial use?
    ... Variants can be considered as such a common OO pattern that it is worth ... Int of int ... As lists are built-in, they can be decomposed in a pattern just as they are ... features found in other state-of-the-art programming languages. ...
  • Re: Bug/Gross InEfficiency in HeathFields fgetline program
    ... Maybe this is true in the sort of programming you do, ... you are storing a list of amounts of money as integers. ... int average ... the array, rounded towards zero. ...
  • Re: beginner with programming, how to learn to debug and few C general questions
    ... I am first an accountant and decided to take on programming a few ... I have mainly been programming under Windows Xp DJGPP Dolorie... ... int main ... If you fix all of the above problems, it might fix whatever the issue ...
  • Re: Lisp version of a Cism
    ... > int main{ ... This may be nice code for a newbie textbook on C programming, ... that include any kind of cross-platform portability, ... When we compare it to Lisp, we find that all the high level stuff is ...