Click here to Skip to main content
15,899,825 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Delphi Pin
GenJerDan2-Aug-17 19:47
GenJerDan2-Aug-17 19:47 
GeneralRe: Delphi Pin
BillWoodruff2-Aug-17 22:05
professionalBillWoodruff2-Aug-17 22:05 
AnswerRe: VB haters, look away Pin
RickZeeland2-Aug-17 6:12
mveRickZeeland2-Aug-17 6:12 
Generalswitch statement Pin
Clifford Nelson2-Aug-17 6:16
Clifford Nelson2-Aug-17 6:16 
GeneralRe: switch statement Pin
PIEBALDconsult2-Aug-17 7:12
mvePIEBALDconsult2-Aug-17 7:12 
GeneralRe: switch statement Pin
Rainbird Developer2-Aug-17 8:44
Rainbird Developer2-Aug-17 8:44 
GeneralRe: switch statement Pin
BillWoodruff2-Aug-17 22:10
professionalBillWoodruff2-Aug-17 22:10 
GeneralRe: switch statement Pin
kalberts4-Aug-17 0:36
kalberts4-Aug-17 0:36 
Note that this is not at all set by the language defintion, but 100% decided by the compiler writer. I have seen compilers (not C#) that generate completely different code depending on the optimization switches: If you optimize for speed, and the case alternatives are sparse, you may end up with a huge jump table. If you optimize for code size and the number of specific cases is small, it might compile like an if ... elseif ... elseif ... When you switch on strings, hash methods are sometimes used to reduce the number of string comparisons that must be done.

Compilers may try out several different methods of compiling a switch statements, and assign scores to each alternative based on the compiler options, such as optimization and target architecture. The one with the highest score wins, and is passed on to later compiler stages. This sure slows down compilation, but is generally worth it.

A small sidetrack, but closely related: Contrary to common belief, modern standards for sound and image processing, such as MP3 and JPEG, does not specify how the compression is to be done, only how a compressed file is decompressed. A good compressor may try out a handful of different ways to compress the original (sometimes varying wildly in compressed encoding), decompress according to the standard and do a diff with the source material. The alternative with the smallest diff result is selected. (Or, the size of the diff result gives that alternative fewer or more points on the scoreboard, together with e.g. compressed size). The compress-decompress-diff-evaluate sure takes CPU power, but today we have plenty of that, at least for sound and still images.
GeneralRe: switch statement Pin
Clifford Nelson4-Aug-17 4:16
Clifford Nelson4-Aug-17 4:16 
GeneralRe: switch statement Pin
kalberts2-Aug-17 22:47
kalberts2-Aug-17 22:47 
GeneralRe: switch statement Pin
Clifford Nelson4-Aug-17 4:18
Clifford Nelson4-Aug-17 4:18 
GeneralRe: switch statement Pin
kalberts4-Aug-17 4:56
kalberts4-Aug-17 4:56 
GeneralRe: VB haters, look away Pin
Jose A Pascoa2-Aug-17 6:33
Jose A Pascoa2-Aug-17 6:33 
NewsRe: The truth... Pin
Jeremy Falcon2-Aug-17 6:41
professionalJeremy Falcon2-Aug-17 6:41 
GeneralRe: The truth... Pin
ZurdoDev2-Aug-17 6:56
professionalZurdoDev2-Aug-17 6:56 
GeneralRe: The truth... Pin
Jeremy Falcon2-Aug-17 7:21
professionalJeremy Falcon2-Aug-17 7:21 
GeneralRe: The truth... Pin
ZurdoDev2-Aug-17 7:26
professionalZurdoDev2-Aug-17 7:26 
GeneralRe: VB haters, look away Pin
dandy722-Aug-17 6:50
dandy722-Aug-17 6:50 
GeneralRe: VB haters, look away Pin
ZurdoDev2-Aug-17 6:57
professionalZurdoDev2-Aug-17 6:57 
GeneralRe: VB haters, look away Pin
Marc Clifton2-Aug-17 7:07
mvaMarc Clifton2-Aug-17 7:07 
GeneralRe: VB haters, look away Pin
Jeremy Falcon2-Aug-17 7:25
professionalJeremy Falcon2-Aug-17 7:25 
GeneralRe: VB haters, look away Pin
KarstenK2-Aug-17 7:35
mveKarstenK2-Aug-17 7:35 
GeneralRe: VB haters, look away Pin
theoldfool2-Aug-17 7:51
professionaltheoldfool2-Aug-17 7:51 
GeneralRe: VB haters, look away Pin
dandy722-Aug-17 9:04
dandy722-Aug-17 9:04 
GeneralRe: VB haters, look away Pin
RedDk2-Aug-17 8:35
RedDk2-Aug-17 8:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   476 votes