Click here to Skip to main content
15,890,282 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalproblem using Select() on multicast server Pin
eli1502197919-Mar-05 21:10
eli1502197919-Mar-05 21:10 
QuestionPower control ? Pin
Still learning how to code19-Mar-05 20:03
Still learning how to code19-Mar-05 20:03 
AnswerRe: Power control ? Pin
ThatsAlok20-Mar-05 18:06
ThatsAlok20-Mar-05 18:06 
GeneralCPropertyPage and CDialog Pin
Yaron Abershitz19-Mar-05 19:43
Yaron Abershitz19-Mar-05 19:43 
GeneralRe: CPropertyPage and CDialog Pin
Renjith Ramachandran20-Mar-05 16:06
Renjith Ramachandran20-Mar-05 16:06 
GeneralVisual C++.Net - Alternative to Large Switch Case Pin
JSadleir19-Mar-05 13:42
JSadleir19-Mar-05 13:42 
GeneralRe: Visual C++.Net - Alternative to Large Switch Case Pin
Member 30761219-Mar-05 20:22
Member 30761219-Mar-05 20:22 
GeneralRe: Visual C++.Net - Alternative to Large Switch Case Pin
Mike Dimmick19-Mar-05 22:53
Mike Dimmick19-Mar-05 22:53 
I don't think it would be particularly slow, actually, but the code would be really large. The compiler is likely to build a jump table rather than a sequence of if/else tests.

As to how to implement it, it depends whether the data will change over time, and if so, whether you want to allow an administrator to make the changes (in which case some form of external file access is in order). If you think the data is fixed for all time, or if a recompile is acceptable to change the values, I'd create a lookup table. Since it's 10000 values I'd probably write a program to generate the C++ file containing the lookup table! Obviously if you do this it's harder to change values, but on the other hand you won't need to write file handling and validation code, nor have to handle situations where the file is not present or inaccessible.

If you decide to go the external data route, I'd go with a file that fits in with the existing data access and the expected skill of the administrator. If data already comes from a SQL or Jet database, I'd place it there. If it's a flat file, I'd add this as an extra flat file, and so on.

Finally, if the quantity can be computed from some equation, I'd just do the computation rather than the lookup. A few years ago I might have cached the values of computations, or used lookup tables. Now processors are so much faster than RAM that computing most quantities is often quicker than retrieving a precomputed value. Obviously you need to measure this with a profiling tool.

Stability. What an interesting concept. -- Chris Maunder
GeneralRe: Visual C++.Net - Alternative to Large Switch Case Pin
Ravi Bhavnani20-Mar-05 5:41
professionalRavi Bhavnani20-Mar-05 5:41 
GeneralRe: Visual C++.Net - Alternative to Large Switch Case Pin
Blake Miller21-Mar-05 5:36
Blake Miller21-Mar-05 5:36 
GeneralRe: Visual C++.Net - Alternative to Large Switch Case Pin
Ravi Bhavnani21-Mar-05 6:40
professionalRavi Bhavnani21-Mar-05 6:40 
GeneralJabber protocol Pin
Anonymous19-Mar-05 12:42
Anonymous19-Mar-05 12:42 
GeneralRe: Jabber protocol Pin
ThatsAlok20-Mar-05 18:22
ThatsAlok20-Mar-05 18:22 
QuestionUsing command-line? Pin
dSolariuM19-Mar-05 10:34
dSolariuM19-Mar-05 10:34 
AnswerRe: Using command-line? Pin
gamitech19-Mar-05 23:39
gamitech19-Mar-05 23:39 
QuestionHi~ How use CodeProject?? Pin
KonyangUni19-Mar-05 7:41
KonyangUni19-Mar-05 7:41 
GeneralTrackbar Pin
henry12819-Mar-05 5:57
henry12819-Mar-05 5:57 
GeneralDigital Signature Pin
pranavamhari19-Mar-05 3:10
pranavamhari19-Mar-05 3:10 
GeneralRe: Digital Signature Pin
Michael Dunn20-Mar-05 6:00
sitebuilderMichael Dunn20-Mar-05 6:00 
GeneralRe: Digital Signature Pin
pranavamhari20-Mar-05 14:56
pranavamhari20-Mar-05 14:56 
GeneralAPI: which enlists the devices Pin
brilliant10119-Mar-05 1:33
brilliant10119-Mar-05 1:33 
GeneralRe: API: which enlists the devices Pin
Alexander M.,19-Mar-05 4:41
Alexander M.,19-Mar-05 4:41 
GeneralSetting System Time Pin
gopalkr19-Mar-05 0:13
gopalkr19-Mar-05 0:13 
GeneralRe: Setting System Time Pin
ThatsAlok19-Mar-05 2:38
ThatsAlok19-Mar-05 2:38 
Questionhow to use set in snmp Pin
narasimhavarmap18-Mar-05 19:39
narasimhavarmap18-Mar-05 19:39 

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.