groff
[Top][All Lists]
Advanced

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

Re: [PATCH v1 1/2] [troff]: Add lengthof() macro.


From: James K. Lowden
Subject: Re: [PATCH v1 1/2] [troff]: Add lengthof() macro.
Date: Mon, 7 Aug 2023 04:56:00 -0400

On Fri, 4 Aug 2023 15:40:30 +0200
Alejandro Colomar <alx@kernel.org> wrote:

> I also dislike the idea of C++ deprecating macros.  IMO, they had to
> do it because they bloated the language so much with dubious features
> that make macros (and other C features) be unsafe.  

The need for macros in C++ is greatly diminished by templates.  Unlike
macros, templates compile.  That gives them geniune safety.  Like
macros, they must be written correctly.  Unlike macros, they're checked
by the compiler.  

Replacing macros with templates was and is a goal of introducing
templates into the language.  

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-macros2

--jkl



reply via email to

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