This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ANSI-C commant __line__ == -1

Genius 4170 points

Other Parts Discussed in Thread: MSP430F5438

Hello everyone,

 

i have a little question: i am using the msp430f5438 experiment board. There is a programm for testing issues preinstalled.

 

UserExpirience, some might know it, which explains all the functions of the MSP430, for example there are LEDs blinking, then there is a LCD attached, which can show a  lot of things, like clock or little games.

 

Now my question is something code-specific, in the library of this project:

\MSP-EXP430F5438_User_Experience_16KB\F5XX_6XX_Core_Lib\hal_macros.h

 

there is this macro:

 

/*
 *  This macro is for use by other macros to form a fully valid C statement.
 */
#define st(x)      do { x } while (__LINE__ == -1)

 

and i do not understand what the while-statement is about, i already know that __LINE__ will give out the current program-line, but how can this ever be "-1"?

And i know what the whole define statement does, so this is not my problem.

 

I assume this is some standart C-command, so i hope some of you can easily explain it to me.

 

Later in the programm this macro is used like this:

 

/*************************************************************************
* MACROS
**************************************************************************/

/* Select source for FLLREF  e.g. SELECT_FLLREF(SELREF__XT1CLK) */
#define SELECT_FLLREF(source) st(UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (source);)
/* Select source for ACLK    e.g. SELECT_ACLK(SELA__XT1CLK) */
#define SELECT_ACLK(source)   st(UCSCTL4 = (UCSCTL4 & ~(SELA_7))   | (source);)
/* Select source for MCLK    e.g. SELECT_MCLK(SELM__XT2CLK) */
#define SELECT_MCLK(source)   st(UCSCTL4 = (UCSCTL4 & ~(SELM_7))   | (source);)

 

I guess it is just some kind of check, if the statement can be true at all or something.

Thanks for youre time and effort.

Greetings, Seb.