On Thu, Jul 20 2000 Thomas Wouters wrote: > > I just went over all of the Python source, using this little program > (which I called findkrc.py): > > import sys, string > > for file in sys.argv[1:] > d = open(file).read() > if string.find(d, ";\n{") <> -1 or string.find(d, "()\n{") <> -1: > print file > > (using find -name '*.[ch]' -print | xargs ./findkrc.py) > > And I fixed almost all of the instances of K&R C syntax. However, I found a > lot of instances of the 2nd type: empty argument list. However, as far as I > remember, ANSI C states that should be written as '(void)'. Is that a > non-issue, and should I not bother fixing those ? (Most of the files in > Modules/ has one or more instances of those.) There is a difference between a function *declaration* and a function *definition*. The former, a function declaration, tells the compiler, this is the type of the function (and its arguments). In a function declaration it is useful to make the distinction between "no arguments" and "unknown arguments". This is done by using the "void" keyword. So int foo(); means that there is a function named "foo" that returns an int and with unknown arguments. int bar(void); means that there is a function named "bar" that returns an int and that doesn't take any arguments. However in a function definition you *must* specify the arguments. So if you define a function int foo() { ... } it is clear that foo doesn't have any arguments. There is no difference with int foo(void) { ... } -- Sjoerd Mullender <sjoerd.mullender@oratrix.com>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4