Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

GCC attributes

<< < (4/6) > >>

sethjackson:

--- Quote from: Takeshi Miya on December 18, 2005, 01:46:27 am ---I vote for cbEVILMACRO convention.

--- End quote ---

I'll second. :lol:

rickg22:
I third. I believe that's the way it should be.

thomas:
Lest someone pronouces fo(u)rth, I removed gcc attributes.

Urxae:

--- Quote from: thomas on December 18, 2005, 03:29:31 pm ---Lest someone pronouces fo(u)rth, I removed gcc attributes.

--- End quote ---

Nobody said they had to go entirely, just that the following spelling was preferred to the one with all the underscores:


--- Code: ---// Attributes and builtins used when compiling Code::Blocks with gcc
// No effect (short of being documentary) with other compilers
//
// $Id$

#ifndef GCC_ATTRIBS
#define GCC_ATTRIBS

#if __GNUC__ >= 3   // ----------------------------------

#define likely(x)               __builtin_expect(!!(x),1)
#define unlikely(x)             __builtin_expect(!!(x),0)
#define compiler_constant(x)    __builtin_constant_p(x)
#define cpu_prefetch(x)         __builtin_prefetch(x)

#define cbINLINE                __attribute__ ((always_inline))
#define cbNOINLINE              __attribute__ ((noinline))
#define cbNOTHROW               __attribute__ ((nothrow))
#define cbDEPRECATED            __attribute__ ((deprecated))
#define cbCONST                 __attribute__ ((const))
#define cbPURE                  __attribute__ ((pure))
#define cbCHECKRESULT           __attribute__ ((warn_unused_result))
#define cbMALLOC                __attribute__ ((malloc))

#ifdef __WIN32__
  #define cbFASTCALL            __attribute__ ((fastcall))
  #define cbFASTESTCALL         __attribute__ ((regparm(3)))
#else
  #define cbFASTCALL
  #define cbFASTCALL
#endif

#else               // ----------------------------------

#define likely(x)               (x)
#define unlikely(x)             (x)
#define compiler_constant(x)    false
#define cpu_prefetch(x)

#define cbINLINE                inline
#define cbNOINLINE
#define cbNOTHROW
#define cbDEPRECATED
#define cbCONST
#define cbPURE
#define cbCHECKRESULT
#define cbMALLOC

#define cbFASTCALL
#define cbFASTCALL


#endif              // ----------------------------------


#endif
--- End code ---

killerbot:
I just looked at 1 file that Thomas changed, tokenizer.h
I see some methods being defined within the class body, add also the keyword inline specified.

The keyword inline is not that interesting, since it is just a hint to the compiler !!!

Secondly, methods being implemented within the class definition/body are , according to the standard, to be inlined !!!


Lieven

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version