A few simple C questions
A few Qs maybe I should know the answers to...
Q1
How efficient is a really long case statement?
I''m going to have a loop which runs lots of times and has lots of cases (with numbers in order, if that helps). Is it better just to put a few IFs around to cut it in 1/2s and 1/4s?
Q2
Is there some command line option that stops at a certain number of errors (would be handy for my current setup). My compiler is djgpp.
Q3
Is there some function which tells you how much memory you have left? This would be handy for checking if I''m making more objects than I''m deleting.
1: it''s probably just as efficient as the equal numbe or if statements, just easier to type.
2: not that I know of for DJGPP, but you can with MSVC++.
3: the start->programs->applications->system tools->resource meter. read you resources before and after you run your program for memory leaks. for actually finding how much memory is used there a few prorams out there the will do that. I don''t remember any names but I do remember seeing them.
JoeMont001@aol.com www.polarisoft.n3.net
2: not that I know of for DJGPP, but you can with MSVC++.
3: the start->programs->applications->system tools->resource meter. read you resources before and after you run your program for memory leaks. for actually finding how much memory is used there a few prorams out there the will do that. I don''t remember any names but I do remember seeing them.
JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
If you''re using VC++, then you should check out _CrtDumpMemoryLeaks in the docs. Very useful functions for detecting leaks.
July 14, 2000 12:21 AM
Jump tables are faster than big switch statements. Some compilers will try and convert big switch statements into jump tables. You might build it and look at the disassembly and see what it''s doing.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement