4

I'm writing a code that extracts information about functions (prototype) and types (enum, struct, typedef) from a C source file.

This is to augment the type information about a particular function or type in my documentation.

Basically, I don't want to manually specify type information because that information can already be found in the source code itself.

Now I'm a bit indecisive about how to name that "extracted" information.

I thought about calling it c meta data or c symbols although I'm not sure what constitutes a symbol in C: I'm not sure if a struct type is a symbol, for example.

c types would also be "wrong" because functions are not types.

Is there a canonical term that both covers function prototypes AND type information?

7
  • 6
    "Types" is actually a reasonable choice, even if functions are involved. The signature of a function object is its type, and in C you can have function pointers whose type describes their signature. Commented Dec 6, 2022 at 14:30
  • 2
    I believe the standard calls these "declarations". A mere type is not a symbol, although a function is a symbol.
    – pjc50
    Commented Dec 6, 2022 at 15:42
  • 1
    Consider: Declared Types. Would exclude primitives and predefined types. Commented Dec 6, 2022 at 17:23
  • This is also the information typically found in C-style "header" files, though still text, of course.
    – Erik Eidt
    Commented Dec 6, 2022 at 20:05
  • Another tip: there are various "language server" tools for e.g. emacs and VSCode which can already do this in a standard way, which may save you time
    – pjc50
    Commented Dec 7, 2022 at 11:54

2 Answers 2

1

Why not name it "declarations" or "declared types"?

Every declared function also has a declared type.

-1

An "identifier" is a generic word which can refer to keywords, types, variable names, function names, macros... They are sequences of letters, digits and underscores.

Additionally, you could use something like "c documentation" (more suitable as a title) or "c elements" (very generic, obviously).

Please remember that a "symbol" is usually only one character (either single byte, or multi-byte).


Note: you might want to have a look at the Doxygen project (open-source) which has a similar purpose, and see what words / terms they use.

3
  • Thanks for your answer. Identifier is too generic for my use case.
    – Marco
    Commented Dec 8, 2022 at 21:48
  • And I think you misunderstood the meaning of symbol in that context. I'm not talking about characters or bytes but exported symbols from a binary.
    – Marco
    Commented Dec 8, 2022 at 21:48
  • And how is "functions ... and types ... from a C source file" similar with "exported symbols from a binary"? Now I understand better your meaning of "symbol", but the question is now suddenly ambiguous.
    – virolino
    Commented Dec 9, 2022 at 6:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.