Steve R.
Retired
- Local time
- Today, 05:27
- Joined
- Jul 5, 2006
- Messages
- 5,427
As a non-programmer, I have often wondered why "C" retains a "primitive" structure since it is compiled. I would assume that a compiler would be designed by now to make all the {,/,+ obsolete?
"C" is not a new programming language, so I would have expected the compilers, by this time, to have evolved to remove these "formatting" landmarks as unneccessary. (Yes I recognize the "//" as begin comment. and the ++ must identify the that the preceeding name is a function. I may be answering my own question!)
"C" is not a new programming language, so I would have expected the compilers, by this time, to have evolved to remove these "formatting" landmarks as unneccessary. (Yes I recognize the "//" as begin comment. and the ++ must identify the that the preceeding name is a function. I may be answering my own question!)
Code:switch(TestCondition) { case 1: TestCondition++; //increment by one break; case 2: TestCondition++; //increment by one goto case 1; //move the control to the first case, having the effect of increasing by two case else: break; //Do nothing }
And I was thinking how nice it would be to have this and I realized it can be done with a bit extra typing:
Code:Select Case TestCondition Case 1 1 TestCondition=TestCondition+1 Case 2 TestCondition=TestCondition+1 Goto 1 Case Else End Select
Note the '1' used as a line number to indicate the jump point for the subsequent case numbers. Still using that ugly goto, but at least we can blame C#/C++ for that.![]()