Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDirectory Size Pin
john563222-Sep-11 17:06
john563222-Sep-11 17:06 
QuestionRe: Directory Size Pin
David Crow22-Sep-11 17:17
David Crow22-Sep-11 17:17 
AnswerRe: Directory Size Pin
john563222-Sep-11 17:41
john563222-Sep-11 17:41 
AnswerRe: How to get size of all files in a directory Pin
Software_Developer22-Sep-11 22:26
Software_Developer22-Sep-11 22:26 
QuestionCode Signing Considerations Pin
Bram van Kampen22-Sep-11 13:39
Bram van Kampen22-Sep-11 13:39 
Questionuse of child CFrameWnd in Visual Studio 2008 [SOLVED] Pin
Jim Crafton22-Sep-11 4:22
Jim Crafton22-Sep-11 4:22 
QuestionPlease give me some idea 3D surface of revolution Pin
appollosputnik22-Sep-11 4:17
appollosputnik22-Sep-11 4:17 
AnswerRe: Please give me some idea 3D surface of revolution Pin
Stefan_Lang22-Sep-11 22:39
Stefan_Lang22-Sep-11 22:39 
0. your formulae for y and z look ok

1. Do not use malloc (or any other alloc function) to allocate memory for POINT3D or any other class (or struct, which is essentially the same) type! Any class or struct may have constructors and destructors, neither of which will be called when using standard C allocation routines! Even though you didn't explicitely define either, the compiler does create some for you. And besides, you may want to add constructors or destructors later.

2. Don't use realloc, especially in the way you did (you're forcing a realloc on every single iteration of the loop!). Use standard container classes instead, such as std::vector (call #include <vector>). They take care of reallocation and are orders of magnitude more efficient at it.

3. What happens with the rest of lines that do not start with '1'? Looks like the loop will just try their best on the rest of the line rather than skip to the next line. As there is no check on the number of inputs per line this will mess up the remainder of the input, as will any other unexpected mistake in the input file. Unfortunately the stream operators >> are not that helpful in this regard, check the member functions instead.

4. Your code is truncated.

6. Don't use global variables; the point arrays should be members of your revolution surface class. What would you do if you had two objects of type Revolution Surface?

7. A minor issue: make sensible objects and name them appropriately; a class that represents a 3D revolution surface is sensible, but what is the name 'RevolutionProjView' meant to indicate? What it does indicate is that this object is a view, which it is clearly not. Nor is it a projection. Why not just 'CRevolutionSurface' ?

Also the function name 'drawProfile' seems entirely inappropriate as it doesn't draw anything. Did you mean 'readProfile'?
QuestionHow to free the memory if memory is allocation using memset Pin
hema_soft21-Sep-11 23:05
hema_soft21-Sep-11 23:05 
AnswerRe: How to free the memory if memory is allocation using memset PinPopular
Niklas L21-Sep-11 23:12
Niklas L21-Sep-11 23:12 
AnswerRe: How to free the memory if memory is allocation using memset Pin
CPallini21-Sep-11 23:49
mveCPallini21-Sep-11 23:49 
AnswerRe: You can use the function - free() after first calling malloc() Pin
Software_Developer21-Sep-11 23:54
Software_Developer21-Sep-11 23:54 
AnswerRe: How to free the memory if memory is allocation using memset Pin
Erudite_Eric22-Sep-11 2:58
Erudite_Eric22-Sep-11 2:58 
Questionc++ objects, I don't get it - IIS ADSI object Pin
jkirkerx21-Sep-11 18:57
professionaljkirkerx21-Sep-11 18:57 
AnswerRe: c++ objects, I don't get it - IIS ADSI object Pin
XTAL25621-Sep-11 21:04
XTAL25621-Sep-11 21:04 
AnswerRe: c++ objects, I don't get it - IIS ADSI object Pin
Jim Crafton22-Sep-11 4:27
Jim Crafton22-Sep-11 4:27 
GeneralRe: c++ objects, I don't get it - IIS ADSI object Pin
jkirkerx22-Sep-11 6:17
professionaljkirkerx22-Sep-11 6:17 
GeneralRe: c++ objects, I don't get it - IIS ADSI object Pin
Jim Crafton22-Sep-11 6:24
Jim Crafton22-Sep-11 6:24 
GeneralRe: c++ objects, I don't get it - IIS ADSI object Pin
jkirkerx22-Sep-11 6:52
professionaljkirkerx22-Sep-11 6:52 
Questionlanguage problem in C .. Pin
gateway2321-Sep-11 0:52
gateway2321-Sep-11 0:52 
AnswerRe: language problem in C .. Pin
Stefan_Lang21-Sep-11 1:39
Stefan_Lang21-Sep-11 1:39 
AnswerRe: IsTextUnicode function Pin
Software_Developer21-Sep-11 7:31
Software_Developer21-Sep-11 7:31 
QuestionCombob box get hide at mouse release Pin
Amrit Agr21-Sep-11 0:15
Amrit Agr21-Sep-11 0:15 
AnswerRe: Combob box get hide at mouse release Pin
Code-o-mat21-Sep-11 9:04
Code-o-mat21-Sep-11 9:04 
QuestionMemory Leak Pin
Tal Rasha's Guardianship20-Sep-11 17:38
Tal Rasha's Guardianship20-Sep-11 17:38 

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.