On Tue, Apr 13, 2021 at 03:35:53PM +0200, Thomas Monjalon wrote:
> 24/03/2021 05:26, Tyler Retzlaff:
> > --- a/lib/librte_eal/include/rte_common.h
> > +++ b/lib/librte_eal/include/rte_common.h
> > @@ -31,9 +31,11 @@ extern "C" {
> >  #define typeof __typeof__
> >  #endif
> >  
> > +#ifndef __cplusplus
> >  #ifndef asm
> >  #define asm __asm__
> >  #endif
> > +#endif
> 
> Applied with this explanation:
> 
>     eal: do not redefine asm keyword in C++
>     
>     C++ forbids redefining a keyword as a macro.
>     The keyword asm is conditionally-supported and implementation defined,
>     but it seems our best guess.
>     
>     In C, if asm does not exist, it is defined as __asm__
>     which is a GNU extension.
> 
> 
> One more question:

> Can we have a similar issue with typeof?
> I guess it works because typeof is not a keyword?

typeof isn't a keyword though don't fully understand the benefit of
#define typeof __typeof__ since it just pollutes the application
namespace. extensions and intrinsics generally should stay in the
namespace reserved for use by the compiler `__'.

i would say we will have a similar issue with any keyword defined in the
c++ standard if we are defining any of them.

Reply via email to