Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Richard MacCutchan4-Feb-24 6:16
mveRichard MacCutchan4-Feb-24 6:16 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
jschell5-Feb-24 5:33
jschell5-Feb-24 5:33 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
Salvatore Terress5-Feb-24 6:38
Salvatore Terress5-Feb-24 6:38 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
k50545-Feb-24 7:10
mvek50545-Feb-24 7:10 
GeneralRe: "connect" with "lambda" C++ code analysis , please. Pin
jschell6-Feb-24 4:40
jschell6-Feb-24 4:40 
Questionstrlen innards Pin
mike74112-Feb-24 12:02
mike74112-Feb-24 12:02 
AnswerRe: strlen innards Pin
Richard MacCutchan2-Feb-24 21:52
mveRichard MacCutchan2-Feb-24 21:52 
AnswerRe: strlen innards Pin
jschell5-Feb-24 5:58
jschell5-Feb-24 5:58 
Presumably already clear what the 4/8 block is used in the first place.

Googling with following provides some answers.

explain strlen himagic lomagic


Following line is the key

if (((longword - lomagic) & ~longword & himagic) != 0)


I tried eye balling that and using examples in my head but still not clear. I believe it is relying on arithmetic overflow.

If I wanted to understand that I would write up some test code with examples characters (4 blocks) with zero at the end (position 4, 3, 2, 1). Then have it print the results of each clause in the above if using binary representation (1 and 0) to see how the bits look for each different example and for each part of the clause.

Perhaps as a learning experience also copy that code into your own space and then write a test jig to time results via that and using the more straightforward (just by char) code. You should start with a large number of runs like probably at least 100,000.
QuestionMissing "type specifier " ? Pin
Salvatore Terress2-Feb-24 5:37
Salvatore Terress2-Feb-24 5:37 
AnswerRe: Missing "type specifier " ? Pin
Mircea Neacsu2-Feb-24 5:52
Mircea Neacsu2-Feb-24 5:52 
AnswerRe: Missing "type specifier " ? Pin
jschell2-Feb-24 5:53
jschell2-Feb-24 5:53 
GeneralRe: Missing "type specifier " ? Pin
k50542-Feb-24 7:28
mvek50542-Feb-24 7:28 
AnswerRe: Missing "type specifier " ? Pin
RedDk2-Feb-24 7:39
RedDk2-Feb-24 7:39 
GeneralRe: Missing "type specifier " ? Pin
Salvatore Terress2-Feb-24 8:02
Salvatore Terress2-Feb-24 8:02 
GeneralRe: Missing "type specifier " ? Pin
Salvatore Terress2-Feb-24 9:05
Salvatore Terress2-Feb-24 9:05 
GeneralRe: Missing "type specifier " ? Pin
Mircea Neacsu2-Feb-24 10:44
Mircea Neacsu2-Feb-24 10:44 
GeneralRe: Missing "type specifier " ? Pin
k50542-Feb-24 12:15
mvek50542-Feb-24 12:15 
GeneralRe: Missing "type specifier " ? Pin
Salvatore Terress2-Feb-24 15:28
Salvatore Terress2-Feb-24 15:28 
QuestionPreTranslateMessage method is missing Pin
utcode1-Feb-24 16:35
utcode1-Feb-24 16:35 
AnswerRe: PreTranslateMessage method is missing Pin
Victor Nijegorodov1-Feb-24 22:41
Victor Nijegorodov1-Feb-24 22:41 
QuestionPrinting to exact coordinates on paper or lottery tickets Pin
inlandchris11-Feb-24 6:31
inlandchris11-Feb-24 6:31 
AnswerRe: Printing to exact coordinates on paper or lottery tickets Pin
Gerry Schmitz1-Feb-24 7:56
mveGerry Schmitz1-Feb-24 7:56 
GeneralRe: Printing to exact coordinates on paper or lottery tickets Pin
inlandchris11-Feb-24 15:12
inlandchris11-Feb-24 15:12 
Questionhow to bypass loop ? Pin
Salvatore Terress28-Jan-24 6:10
Salvatore Terress28-Jan-24 6:10 
AnswerRe: how to bypass loop ? Pin
k505428-Jan-24 6:30
mvek505428-Jan-24 6:30 

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.