• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/H22-Dec-2021-24,34716,355

m4/H22-Dec-2021-11,16910,416

man/H22-Dec-2021-2,9132,816

src/H22-Dec-2021-33,59518,204

test/H22-Dec-2021-21,58217,724

.gitattributesH A D22-Dec-202178 43

.gitignoreH A D22-Dec-2021252 3229

AUTHORSH A D22-Dec-20214.4 KiB117107

COPYINGH A D22-Dec-202134.3 KiB675553

ChangeLogH A D22-Dec-2021399.1 KiB8,2976,953

DoxyfileH A D22-Dec-20212.3 KiB7062

INSTALLH A D22-Dec-202115.4 KiB371289

Makefile.amH A D22-Dec-20211.9 KiB8045

NEWSH A D22-Dec-202155.6 KiB1,9631,277

README.mdH A D22-Dec-20215.6 KiB220193

bootstrapH A D22-Dec-20211.5 KiB6118

cdecl.cssH A D22-Dec-20211.1 KiB3933

configure.acH A D22-Dec-20219.9 KiB275253

lcovrcH A D22-Dec-2021947 2522

makedoc.shH A D22-Dec-20211.5 KiB5517

README.md

1# cdecl
2
3## Introduction
4
5> *I’m still uncertain about the language declaration syntax, where in
6> declarations, syntax is used that mimics the use of the variables being
7> declared.  It is one of the things that draws strong criticism, but it has a
8> certain logic to it.*
9
10<div style="text-align: center">
11&mdash; Dennis M. Ritchie
12</div>
13<p></p>
14
15> *I consider the C declarator syntax an experiment that failed.*
16
17<div style="text-align: center">
18&mdash; Bjarne Stroustrup
19</div>
20<p></p>
21
22**cdecl** (_see-deh-kull_)
23is a program for composing and deciphering C (or C++)
24declarations or casts, aka ‘‘gibberish.’’
25It can be used interactively on a terminal or
26accept input from either the command line or standard input.
27For example:
28
29```
30cdecl> explain int *const (*p)[4]
31declare p as pointer to array 4 of const pointer to int
32
33cdecl> declare p as pointer to const pointer to const char
34const char *const *p;
35```
36
37This codebase fixes virtually all the deficiencies in earlier versions
38as well as adds many new features,
39most notably:
40
41* Using GNU Autotools for building.
42* Command-line long-options.
43* Distinguishes among
44  K&R C,
45  C89,
46  C95,
47  C99,
48  C11,
49  C17,
50  C2X,
51  C++98,
52  C++03,
53  C++11,
54  C++14,
55  C++17,
56  C++20,
57  and
58  C++23.
59* Support for C89
60  `const`,
61  `restrict`,
62  and
63  `volatile`
64  qualifiers.
65* Support for C99
66  `static`,
67  type-qualified,
68  and
69  variable length array
70  function parameters.
71* Support for C99 extensions
72  [Embedded C](http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1021.pdf)
73  and
74  [Unified Parallel C](https://upc.lbl.gov/).
75* Support for `inline` function and variable declarations.
76* Support for `typedef` declarations.
77* Pre-defined `typedef` declarations
78  for many POSIX and standard library types
79  (`FILE`,
80   `in_addr_t`,
81   `int8_t`,
82   `pid_t`,
83   `pthread_t`,
84   `ptrdiff_t`,
85   `size_t`,
86   `std::ostream`,
87   `std::string`,
88   etc.),
89  and all
90  [Microsoft Windows types](https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types).
91* Support for [Microsoft Windows calling conventions](https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions).
92* Support for variadic function parameters.
93* Support for C and C++ alternative tokens
94  (`and`, `and_eq`, etc.).
95* Support for C++
96  constructors,
97  destructors,
98  `mutable` data members,
99  namespaces and scoped names,
100  new-style casts,
101  pointers to members,
102  `throw`,
103  overloaded operators,
104  and
105  `friend`,
106  `virtual` and pure `virtual`
107  member function declarations,
108  and
109  user-defined conversion operators.
110* Support for C++11
111  `auto` (as a deduced type),
112  `constexpr`,
113  `enum class`,
114  fixed-type enumerations,
115  `final`,
116  `noexcept`,
117  `override`,
118  rvalue references,
119  user-defined literals,
120  `using` (as a `typedef` synonym),
121  the function trailing return-type syntax,
122  and
123  ref-qualified member function declarations.
124* Support for C++20
125  `consteval`,
126  `constinit`,
127  and
128  `export`
129  declarations.
130* Support for C++
131  `[[carries_dependency]]`,
132  `[[deprecated]]`,
133  `[[maybe_unused]]`,
134  `[[nodiscard]]`,
135  and
136  `[[noreturn]]`
137  attribute specifiers.
138* Better warning and error messages
139  complete with location information,
140  color,
141  and "Did you mean ...?" suggestions.
142
143## Installation
144
145The git repository contains only the necessary source code.
146Things like `configure` are _derived_ sources and
147[should not be included in repositories](http://stackoverflow.com/a/18732931).
148If you have
149[`autoconf`](https://www.gnu.org/software/autoconf/),
150[`automake`](https://www.gnu.org/software/automake/),
151and
152[`m4`](https://www.gnu.org/software/m4/)
153installed,
154you can generate `configure` yourself by doing:
155
156    ./bootstrap
157
158You will also need
159[`flex`](https://github.com/westes/flex)
160and
161[`bison`](https://www.gnu.org/software/bison/)
162(`lex` and `yacc` won't do);
163or you can download a
164[released version](https://github.com/paul-j-lucas/cdecl/releases)
165that contains `configure`
166and the generated lexer and parser.
167In either case,
168then follow the generic installation instructions given in
169[`INSTALL`](https://github.com/paul-j-lucas/cdecl/blob/master/INSTALL).
170
171If you would like to generate code coverage reports,
172you will also need
173`gcov` (part of `gcc`)
174and
175[`lcov`](https://github.com/linux-test-project/lcov);
176then instead do:
177
178    ./configure --enable-coverage
179    make check-coverage
180
181If you would like to generate the developer documentation,
182you will also need
183[Doxygen](http://www.doxygen.org/);
184then do:
185
186    make doc                            # or: make docs
187
188## Licensing
189
190**cdecl** was originally written by Graham Ross
191sometime in the mid-1980s.
192Tony Hansen, a major contributor,
193[posted the source code with his changes](https://groups.google.com/d/msg/comp.sources.unix/Y76scbXQQBk/MVrZZBG0nNwJ)
194to `comp.sources.unix` in 1988.
195
196The source files have never had either a copyright notice or license.
197Attempts have been made independently by several people
198to contact Graham over the years to clear-up the licensing issue,
199all without success.
200
201In 1996,
202David Conrad made contributions for version 2.5 and wrote:
203
204> *I have no reason to believe there are any limitations on [**cdecl**'s] use,
205> and strongly believe it to be in the Public Domain.*
206
207(See the included
208[`README-2.5.txt`](https://github.com/paul-j-lucas/cdecl/blob/master/README-2.5.txt)
209for David's full comments.)
210
211Something in the Public Domain allows anyone to do whatever they want with it.
212Assuming that David is correct
213and that **cdecl** is in the Public Domain,
214I therefore am licensing **cdecl** 3.0 (and later) under the
215[GNU General Public License, v3](https://www.gnu.org/licenses/gpl-3.0.en.html).
216
217**Paul J. Lucas**
218San Francisco, California, USA
21916 April 2017
220