Info-Mac Archive Downloads: dev/src/ SourceCode

Back to dev/src/ SourceCode

dcl-ANSI (all) (dcl-ansi-c.hqx)

Download dcl-ansi-c.hqx (41,473 KB)


From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
Subject: dcl-ANSI (all)
Date: Thu, 22 Apr 93 0:45:35 EDT

C's method of declaring variables and functions is one of the most confusing
parts of the language. Even old pros will double- and triple-check their
arrays of pointers. And the pathological cases are truly bizarre:
"int(Int(int(Int)))" declares a function that accepts and returns an int, but
"int(Int(int(int)))" declares a function that accepts another function,
and _that_ function accepts and returns an int. Weird stuff.

"dcl-ANSI" lets you type in a declaration, hit a few keys, and see what it
means, in plain English. Tell it "int (*x[])()" and it tells you x is "type
array[] of pointer to function with undefined parameters returning type int."
It's based on the "dcl" program in section 5.12 of K&R, but, as the name
implies, it fully understands ANSI. (Well, OK, there are a few limitations.
See the readme for details.) And it's public domain.

There are two editions of this utility. It was first created as a BBEdit
extension, because (1) I like BBEdit and (2) BBEdit provides a particularly
nice environment for hacks like this to live in. If you keep BBEdit open
while programming, you may prefer this version. Otherwise, you'll probably
want to use the second edition, the FKEY, because it's simpler: just
select your declaration, hit cmd-C and cmd-shift-9 [*], and the English
explanation is in the clipboard, waiting for you to paste it somewhere.

This file contains both editions and their complete Think C 5 source code.

Suggested archive destination: .../source/c/dcl-ansi.hqx
--
Jamie McCarthy Internet: k044477@kzoo.edu AppleLink: j.mccarthy