Re: A source file de-tabifier for you

From: Leor Zolman (leor_at_bdsoft.com)
Date: 05/16/04


Date: Sun, 16 May 2004 11:37:10 -0400

On Sun, 16 May 2004 11:16:52 -0400, Leor Zolman <leor@bdsoft.com> wrote:

>Following is plist.c, a program I originally wrote to help me format source
>listings for publication in CUJ articles

Heh, I just noticed this still uses old-style K&R function headers, e.g.,

int foo(a,b)
int a, int b
{
        ...
}

Think of it as nostalgic ;-) Believe it or not, the C compiler I was using
the most at the time, under SCO Xenix, only supported C prototypes when you
did /not/ include the identifier names for parameters; that is, for the
program above, the prototype:
        int foo(int, int);
would have been okay, but if I'd written:
        int foo(int a, int b);
the compiler would have choked. Thus I stuck with old-style function
headers somewhat longer into the post-C89 era than I would have if I
weren't porting code back and forth between DOS and Xenix at the time...
        -leor

-- 
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix  
C++ users: download BD Software's free STL Error Message Decryptor at:
   www.bdsoft.com/tools/stlfilt.html


Relevant Pages

  • Re: Why is this not an error in Visual C?
    ... says that when an old-style function definition is processed, ... That is, I think, `int fint x; ... Concerning the compatibility of function ... All declarations in the same scope that refer to the same object or function ...
    (comp.lang.c)
  • Re: function call with arguments which takes no arguments
    ... >> Even compiler doesn't show any warning. ... > C allows function declarations with empty parentheses for backwards ... > correct if he/she chooses NOT to use prototypes. ... There is no "int ...
    (comp.arch.embedded)
  • Re: Why is this not an error in Visual C?
    ... says that when an old-style function definition is processed, ... That is, I think, `int fint x; ... Concerning the compatibility of function ... All declarations in the same scope that refer to the same object or function ...
    (comp.lang.c)
  • Re: The importance of prototypes
    ... > It is my understanding that prototypes in C are purely optional. ... > So, am I wrong and prototypes are mandatory, kinda like in C++? ... > integer arguments and thus puts in a type cast for me? ... argument, and you pass it an int, you must cast the int to double. ...
    (comp.lang.c)
  • Re: Can function prototypes appear anywhere?
    ... and returning a pointer to int? ... scope shall have no explicit storage-class specifier other than ... and since the same can't be done for static-linkage ... functions, you'd end up with inconsistent placement of prototypes, ...
    (comp.lang.c)