Engineer, 31, dies after befriending ChatGPT bot which convinced her to change her medication dose
Inside £1m Essex bungalow tucked away on sought-after private estate
Inside £1m Essex bungalow tucked away on sought-after private estate
Chancellor's numbers only add up because they were made up, warns leading economist
Obama mocks Trump for 'mobilizing whole government' to respond to his Cheesecake Factory joke: 'He was very upset'
These are the best cosy jumpers under £50 - and how to style them without looking frumpy
Plans agreed for 182 homes near 'dangerous' Brentwood road despite residents' fears
Ink Droplets In Motion Snag Top Prize In Nikon Small World Contest
Read more of this story at Slashdot.
Healey has launched yet another spiteful attack on the prudent - why I fear this is just the calm before the storm, says JEFF PRESTRIDGE
Victory for the Mail and This is Money as Healey axes Reeves' cash Isa raid
ANDREW NEIL: Labour believes in deficit reduction on the never-never. The more Healey talked of prudence, the more we noticed his profligacy...
Man accused of murdering 26-year-old woman in the street is attacked and robbed behind bars
CodeSOD: Oh, K?
Pierre found this cry for help:
for (j = 0; j < DISTRICT_CARDINALITY; j++) { /* * A poor way to work around some sort of memory * violation. k gets clobbered, so I buffer l with it. * Help? */ for (k = 0, l = 0; k < customers; k++, l++) { /* c_id */ FPRINTF(output, "%d", l + 1); METAPRINTF((output, "%c", delimiter));Honestly, I'm always a little worried in C-like languages when the loop variable isn't scoped to the loop and declared in place. Always concerning, so when there's concerns with clobbering, I'm not surprised.
This iterates across a set of "districts", and then iterates across a list of customers. Standard output functions are replaced with macros, and honestly, I don't know that I want to know what happens in METAPRINTF.
But fine, this iterates across a bunch of stuff and generates output. It's the comment that we're really curious about. "Some sort of memory violation", so we duplicate our loop variable. What on earth could be happening here?
Well, Pierre found the "memory violation", which is probably what you expected:
k = strlen(someOutputString) - 8;k is used elsewhere in the loop as a variable. That's not a memory violation, that's just how variables work.
This leaves us with one possible conclusion: the developer who wrote the comment couldn't find this bug. And given the weird use of macros here, I'm going to go out on a limb and guess that it's not the developer's fault; I strongly suspect the loop is so long, so complicated, and so obfuscated that very few developers could find that.
My earlier complaint about scoping the variable to the loop wouldn't fix this, which I guess is on me. They still should really scope the variable to the loop.
.comment { border: none; }