c - What this element ending with ":" in the code means? -


i encountered part of code not able understand:

    } else if(ev != process_event_poll) {      continue; }  again:   //what line do?  u = null;  for(t = timerlist; t != null; t = t->next) { 

the line again: 1 bothers me. explanation welcome.

this again: called label. used markers position of code. not affect code flow themselves.

to quote c11 standard, chapter §6.8.1, labeled statements, general syntax is

labeled-statement:

identifier : statement

case constant-expression : statement
default : statement

where case , default 2 predefined , reserved label names, used special purpose.

also, regarding semantics,

any statement may preceded prefix declares identifier label name. labels in not alter flow of control, continues unimpeded across them.

  • one commonly [mis(?)]used scenario: goto.

  • one used less-noticed scenario: switch statement.


Comments