On 30/11/16 23:08, Diogo Martins Silva wrote:
> Thanks, guys.
> 
> I asked because I tried a code snippet, but was getting errors.
> 
> I found later that the errors came from my IDE's code analysis, not the
> compiler. The code works fine.
> 
> Thumbs up for the assembly examples!
> 

Sometimes it helps to "cheat" a little for the benefit of the IDE.
IDE's code analysis and syntax highlighting is not always in sync with
the compiler, which may have newer standards support or extensions that
confuse the IDE.  I usually have an ECLIPSE symbol defined as part of
the project within Eclipse, but not in my makefile (I use external
makefiles, not the IDE's project management).  Then I could have:

#ifdef ECLIPE
// In the IDE
#define __attribute__(x)

// Old-style static assertion
#define STATIC_ASSERT_NAME_(line)       STATIC_ASSERT_NAME2_(line)
#define STATIC_ASSERT_NAME2_(line)      assertion_failed_at_line_##line
#define static_assert(claim, warning) \
        typedef struct { \
                char STATIC_ASSERT_NAME_(__COUNTER__) [(claim) ? 2 : -2]; \
        } STATIC_ASSERT_NAME_(__COUNTER__)

// Fake 24-bit ints for IDE
typedef long int int24_t;
typedef unsigned long int uint24_t;


#else
// In the compiler

#ifdef __cplusplus
// static_assert is standard in c++11
#else
// C11 static_assertion
#define static_assert _Static_assert
#endif

typedef __int24 int24_t;
typedef __uint24 uint24_t;


#endif


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to