Post Reply 
monic part 6: the mC programming language and compiler
06-25-2022, 06:33 PM
Post: #14
RE: monic part 6: the mC programming language and compiler
In addition to the case/default structuring, because switch is a block, one can declare locals like so:
switch (<expr>)
{
  double x; // local and visible to all cases, this is legal in C
  case <A>:
    <code>
  ...
}

While this is valid C, there is no widespread use as far as I can tell and few know about this. Initializers of locals in this switch block are also just ignored. Also, declaring variables with initializers in case blocks require braces. On the other hand, the PC-G850 doesn't permit variable declarations anywhere except at the start of a function. Simplified C is still very workable!

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: monic part 6: the mC programming language and compiler - robve - 06-25-2022 06:33 PM



User(s) browsing this thread: 2 Guest(s)