How to create large files with c?

D

David Thompson

This is the first piece of C code I've ever posted (and one of the few I've
written for that matter), and in this small fragment already some pitfalls:

* Function calls must always end with (), empty or not. That's why no
warning of the missing parameter. Easy to miss off, coming from other
languages

FWIW, Fortran and PL/I also require parens for a function call even
with no args (but not a subroutine, which those languages unlike C
distinguish syntactically from functions). In the latter the lone name
gives a value of type ENTRY, which is a pointer to the code bound with
pointer(s) to the context stack frame(s) for a nested routine; this is
semantically analagous to the C version.

Also in LISP all function calls (applications) must be explicit, but
there they have the excuse that the function itself is a meaningful
value, which can be manipulated as data, separate from the value
produced from applying it to any or no arguments. That is,
(DEFUN FOO () (PRINT 'HI) 42)
(FOO) or equivalently (APPLY FOO ()) -> 42
FOO -> (LAMBDA () (PRINT (QUOTE HI)) 42)
or perhaps something like (CLOSURE (LAMBDA ...) ...)
but still something meaningful

More to the point, C's direct ancestor BCPL (via B) required explicit
call in all cases, although I don't think it used parens to do so.
* And if the () is missing, the call is interpreted as.. the address of the
function? Wouldn't a mandatory & in front be better? Then (fclose==0) would
raise an error.

If starting from scratch it might have been; but BCPL and B already
did this, and C evolved from B.
* And if written as a statement, eg. fclose; this generates no code and no
warning!
- formerly david.thompson1 || achar(64) || worldnet.att.net
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top