I’m still uncertain about the language declaration syntax, where in declarations, syntax is used that mimics the use of the variables being declared. It is one of the things that draws strong criticism, but it has a certain logic to it.
I consider the C declarator syntax an experiment that failed.
cdecl (see-deh-kull) is a program for composing and deciphering C (or C++) declarations or casts, aka ‘‘gibberish.’’ It can be used interactively on a terminal or accept input from either the command line or standard input.
This codebase fixes virtually all the deficiencies in earlier versions as well as adds many new features, most notably:
- Using GNU Autotools for building.
- Command-line long-options.
- Distinguishes among K&R C, C89, C95, C99, C11, C17, C2X, C++98, C++03, C++11, C++14, C++17, and C++20.
- Support for C89
const
,restrict
, andvolatile
qualifiers. - Support for C99
static
, type-qualified, and variable length array function parameters. - Support for C99 extensions Embedded C and Unified Parallel C.
- Support for
inline
function and variable declarations. - Support for
typedef
declarations. - Pre-defined
typedef
declarations for all standard C & C++ language types (_Bool
,_Complex
,_Imaginary
,char8_t
,wchar_t
, etc.), many POSIX and standard library types (FILE
,in_addr_t
,int8_t
,pid_t
,pthread_t
,ptrdiff_t
,size_t
,std::ostream
,std::string
, etc.), and all Microsoft Windows types. - Support for variadic function parameters.
- Support for C and C++ alternative tokens
(
and
,and_eq
, etc.). - Support for C++
constructors,
destructors,
mutable
data members, namespaces and scoped names, new-style casts, pointers to members,throw
, overloaded operators, andfriend
,virtual
and purevirtual
member function declarations, and user-defined conversion operators. - Support for C++11
auto
(as a deduced type),constexpr
,enum class
, fixed-type enumerations,final
,noexcept
,override
, rvalue references, user-defined literals,using
(as atypedef
synonym), the function trailing return-type syntax, and ref-qualified member function declarations. - Support for C++20
consteval
,constinit
, andexport
declarations. - Support for C++
[[carries_dependency]]
,[[deprecated]]
,[[maybe_unused]]
,[[nodiscard]]
, and[[noreturn]]
attribute specifiers. - Better warning and error messages complete with location information, color, and "Did you mean ...?" suggestions.
The git repository contains only the necessary source code.
Things like configure
are derived sources and
should not be included in repositories.
If you have autoconf
, automake
, and m4
installed,
you can generate configure
yourself by doing:
./bootstrap
You will also need
flex
and
bison
(lex
and yacc
won't do).
Or you can download a
released version
that contains configure
and the generated lexer and parser.
In either case,
then follow the generic installation instructions given in
INSTALL
.
If you would like to generate the developer documentation, you will also need Doxygen; then do:
make doc # or: make docs
and then open docs/html/index.html
with a browser.
cdecl was originally written by Graham Ross
sometime in the mid-1980s.
Tony Hansen, a major contributor,
posted the source code with his changes
to comp.sources.unix
in 1988.
The source files have never had either a copyright notice or license. Attempts have been made independently by several people to contact Graham over the years to clear-up the licensing issue, all without success.
In 1996, David Conrad made contributions for version 2.5 and wrote:
I have no reason to believe there are any limitations on [cdecl's] use, and strongly believe it to be in the Public Domain.
(See the included
README-2.5.txt
for David's full comments.)
Something in the Public Domain allows anyone to do whatever they want with it. Assuming that David is correct and that cdecl is in the Public Domain, I therefore am licensing cdecl 3.0 (and later) under the GNU General Public License, v3.
Paul J. Lucas
San Francisco, California, USA
16 April 2017