Click here to Skip to main content
14,831,776 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 7:37
mveCPallini31-Mar-11 7:37 
AnswerRe: Anything wrong Pin
Luc Pattyn31-Mar-11 7:41
sitebuilderLuc Pattyn31-Mar-11 7:41 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 8:02
mveCPallini31-Mar-11 8:02 
GeneralRe: Anything wrong Pin
Luc Pattyn31-Mar-11 8:09
sitebuilderLuc Pattyn31-Mar-11 8:09 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 8:17
mveCPallini31-Mar-11 8:17 
AnswerRe: Anything wrong Pin
CPallini31-Mar-11 5:44
mveCPallini31-Mar-11 5:44 
GeneralRe: Anything wrong Pin
Smith#31-Mar-11 5:52
MemberSmith#31-Mar-11 5:52 
GeneralRe: Anything wrong Pin
Waldermort31-Mar-11 6:14
MemberWaldermort31-Mar-11 6:14 
Since you are dealing with strings there isn't a need to clear the whole buffer.

char x[100] = { 0 };
internally calls memset. In your case it's a waste of (7 or so not including the loop inside memset) CPU cycles.
char x[100];
x[0] = 0;
initially creates an empty string. Just 1 CPU cycle.

But then, calling functions like strcpy and sprintf don't require the buffer to be empty whereas strcat NEEDS a string (empty or otherwise) to append to.
Waldermort

GeneralRe: Anything wrong Pin
Smith#31-Mar-11 6:22
MemberSmith#31-Mar-11 6:22 
GeneralRe: Anything wrong Pin
Waldermort31-Mar-11 6:35
MemberWaldermort31-Mar-11 6:35 
GeneralRe: Anything wrong Pin
Luc Pattyn31-Mar-11 7:18
sitebuilderLuc Pattyn31-Mar-11 7:18 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 7:36
mveCPallini31-Mar-11 7:36 
GeneralRe: Anything wrong Pin
Luc Pattyn31-Mar-11 7:39
sitebuilderLuc Pattyn31-Mar-11 7:39 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 8:02
mveCPallini31-Mar-11 8:02 
QuestionCompare And Set 64 bit Pin
Waldermort31-Mar-11 1:40
MemberWaldermort31-Mar-11 1:40 
AnswerRe: Compare And Set 64 bit Pin
Klaus-Werner Konrad31-Mar-11 9:06
MemberKlaus-Werner Konrad31-Mar-11 9:06 
QuestionNeed help on windows socket programming Pin
John50231-Mar-11 0:30
MemberJohn50231-Mar-11 0:30 
AnswerRe: Need help on windows socket programming Pin
Nelek31-Mar-11 0:33
protectorNelek31-Mar-11 0:33 
AnswerRe: Need help on windows socket programming Pin
Dave Calkins31-Mar-11 6:28
MemberDave Calkins31-Mar-11 6:28 
QuestionVC 6 bug? Pin
includeh1030-Mar-11 16:01
Memberincludeh1030-Mar-11 16:01 
AnswerRe: VC 6 bug? Pin
Albert Holguin30-Mar-11 17:10
professionalAlbert Holguin30-Mar-11 17:10 
AnswerRe: VC 6 bug? Pin
_Flaviu30-Mar-11 21:17
Member_Flaviu30-Mar-11 21:17 
AnswerRe: VC 6 bug? Pin
Hans Dietrich30-Mar-11 22:20
mentorHans Dietrich30-Mar-11 22:20 
AnswerRe: VC 6 bug? Pin
CPallini30-Mar-11 22:29
mveCPallini30-Mar-11 22:29 
AnswerRe: VC 6 bug? Pin
Nyil31-Mar-11 1:34
MemberNyil31-Mar-11 1:34 

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.