Skip to content
This repository was archived by the owner on Apr 16, 2020. It is now read-only.
/ cdecl Public archive
forked from paul-j-lucas/cdecl

Composing and deciphering C (or C++) type declarations or casts, aka ‘‘gibberish.’’

License

Notifications You must be signed in to change notification settings

runtimeverification/cdecl

 
 

Repository files navigation

cdecl

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.

-- Dennis M. Ritchie

I consider the C declarator syntax an experiment that failed.

-- Bjarne Stroustrup

cdecl (see-deh-kull) is a program for composing and deciphering C (or C++) type 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 version 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, C++98, C++03, C++11, C++14, and C++17.
  • Support for C99 types int8_t, int16_t, int32_t, int64_t, int_fast8_t, int_fast16_t, int_fast32_t, int_fast64_t, int_least16_t, int_least32_t, int_least64_t, int_least8_t, intmax_t, intptr_t, ptrdiff_t, size_t, ssize_t, uint8_t, uint16_t, uint32_t, uint64_t, uint_fast8_t, uint_fast16_t, uint_fast32_t, uint_fast64_t, uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t, uintmax_t, and uintptr_t.
  • Support for C11 and C++11 types bool, char16_t, char32_t, complex, restrict, thread_local, and wchar_t.
  • Support for inline function and variable declarations.
  • Support for typedef declarations.
  • Support for static, type-qualified, and variable length array function arguments in C.
  • Support for variadic function arguments.
  • Support for C++11 constexpr, enum class, mutable, new-style casts, rvalue references, and the function trailing return-type syntax.
  • Support for const, final, friend, override, volatile, virtual, pure virtual, and ref-qualified C++ member function declarations.
  • Better warning and error messages complete with location information and color.

Installation

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:

autoreconf -fiv

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.

Licensing

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 GPLv3.

Paul J. Lucas
paul@lucasmail.org
San Francisco, California, USA
16 April 2017

About

Composing and deciphering C (or C++) type declarations or casts, aka ‘‘gibberish.’’

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 56.7%
  • M4 20.3%
  • Yacc 7.7%
  • Makefile 6.9%
  • C++ 6.2%
  • Lex 1.6%
  • Shell 0.6%