m4-discuss
[Top][All Lists]
Advanced

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

Recommended m4 macro naming convention?


From: Daniel Goldman
Subject: Recommended m4 macro naming convention?
Date: Thu, 01 May 2014 23:33:17 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

This may seem a silly question to some, but I think naming conventions are important. So, any advice concerning naming conventions for m4 macro names, eg foo_bar, fooBar, Foo_Bar, FOO_BAR, etc?

[A-Z_a-z][A-Z_a-z0-9]* is the requirement for m4 macro names, I hope I got that right, :) so that is not my question.

In cpp, the strong standard is UPPER_CASE, such as:

#define ANALYZES_AGES_UNDER_ONE__________TF FALSE

Of course cpp doesn't care, allows same names as m4. But it is reassuring to always see UPPER_CASE, a dead giveaway for cpp macros.

In the GNU m4 manual, all the builtin macros are lowercase, and the examples almost all use lowercase macro names. But an example from the Gnulib project uses uppercase. sendmail seems to use at least a few uppercase macros, maybe a lot. Some postings on this group use uppercase names. My cpp experience makes me want to use UPPER_CASE. Is there any general guideline, or is it just "whatever you like"? If no general guideline, should there be?

Could one argue builtins behave like "functions" (I know they are macros), so maybe use lower_case for user-defined macros with "function" behavior (just like some C lowercase macros, eg, isascii), and use UPPER_CASE for "pure" macros (simple substitution)?

Thanks,
Daniel



reply via email to

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