Click here to Skip to main content
15,901,853 members

Comments by k5054 (Top 200 by date)

k5054 3 days ago View    
Pete's function has a bug. file.eof() only returns true after a read is attempted beyond the end of the file. Instead of if ( file.eof() ) { try if ( file.peek() == EOF) {
k5054 3 days ago View    
I think you meant a function definition, rather than a call, just to clarify for the OP
k5054 4 days ago View    
Only thing I can suggest is that you build up your expression a bit at a time and examine the values as you go e.g.
$x = ($size - iteration -1);
$y = $shiftby * $x;
$z = 64 - $shiftby;
$val  = $TestVal << $z;
$test |= $val;
print STDERR, "x = $x, y = $y, z = $z, val = $val, test = $test\n';

At least then, you might get an idea where the two versions diverge.
k5054 10-May-24 11:44am View    
You'll need to explain what you're trying to do better.
"my C++ tool does not support inheritance" and " ... is passed to a derived class" are almost oxymoronic. Base/Derived classes are inheritance in C++ speak, something that goes back to pre ANSI C++, I'm sure. So you're doing something else. Maybe nested classes?
k5054 1-May-24 8:06am View    
My 5
To to OP: you can confirm this by changing your printf statement to:
printf("strlen(%s) is %d\n", a, strlen(a))"
which will then print out:
strlen(abc
) is 4