bug-standards
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Prefixing C function names with ‘_’


From: Ludovic Courtès
Subject: Prefixing C function names with ‘_’
Date: Sun, 23 Apr 2017 00:45:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hello,

I just noticed this recommendation from
<https://www.gnu.org/prep/standards/html_node/Libraries.html>:

  External symbols that are not documented entry points for the user
  should have names beginning with ‘_’.

I think this is bad advice because both POSIX and glibc reserve names
starting with an ‘_’.  Quoth
<https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html>:

  […] reserved names include all external identifiers (global functions
  and variables) that begin with an underscore (‘_’) and all identifiers
  regardless of use that begin with either two underscores or an
  underscore followed by a capital letter are reserved names.

Thus I suggest removing this sentence and possibly proposing a different
convention.  Guile uses ‘scm_’ for public functions and ‘scm_i_’ for
internal functions; some libraries use two underscores, as in ’lib__’.

Thoughts?

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]