lol this bug
Mark Oates

{"name":"611455","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d37a6646de7f55bd7517750c811cb641.png","w":550,"h":344,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d37a6646de7f55bd7517750c811cb641"}611455

8-)

Edgar Reynaldo

Try this one:

EAGLE_ASSERT(LoadConfig());

bamccaig

Try this one:

That's a stupid post. >:(

Edgar Reynaldo

huH?

It only calls LoadConfig() in Debug Mode

bamccaig

Without the definition for EAGLE_ASSERT that's impossible to infer. :-/

Edgar Reynaldo

But you can reasonably infer it calls assert on a false return. And if you define NDEBUG, it never gets called. Likewise, if EAGLE_DEBUG is not defined, EAGLE_ASSERT compiles away to nothing, hence it's like you never called LoadConfig() at all in release mode.

bamccaig

Which is only a bug if you know what LoadConfig() does and you know the context of this statement. :P For all we know, it's a unit test for EAGLE_ASSERT. :P

Edgar Reynaldo

If it's an assert, then it's testing a boolean statement. What do you think LoadConfig does but load a configuration? If you don't do it, then obviously you're gonna have problems.

<box>
Think outside the box bambams.
</box>

Dizzy Egg
#SelectExpand
1 2int iLoop; 3 4... 5 6void checkDat() 7{ 8 for(iLoop = 1;iLoop < 20;iLoop++) 9 { 10 checkBytes(&b); 11 } 12} 13 14void checkBytes(int * b) 15{ 16 for(iLoop = 1;iLoop < 8;iLoop++) 17 { 18 if(b < 1) 19 { 20 printMessage("byte out of range"); 21 } 22 } 23}

bamccaig

If it's an assert, then it's testing a boolean statement. What do you think LoadConfig does but load a configuration? If you don't do it, then obviously you're gonna have problems.

Software development is not the place for assumptions.

Think outside the box bambams.
<box>
</box>

FTFY. :P

Chris Katko

I've had so many silly bugs before! I just wish I could remember them for here.

For the longest time, (and I posted a thread years ago about this), I never realized (or always forgot!) that C/C++ treat different numbers... as different numbers.

5; //int 5
5.0; //double

5F; //float
5.0F; //float

So I'd run into errors when I combine ints and floats all the time when I have a bunch of multiplies and divides, but no .0, it wipes it all away (or sometimes just hard-to-notice parts) to zero. It also changes based on the position of the arguments.

No C/C++ book I read growing up ever stressed that issue except (at best) showing a simple diagram with no application explanation about implicit conversion rules.

IIRC, D doesn't allow implicit conversion except in the most obvious of cases and will flag it. But it definitely allows it for custom unit types... I don't know. It's been forever since I looked into this problem I used to subtle bugs from all the time.

https://wiki.dlang.org/Implicit_conversions_in_user_types

C#... allows you to define a user-defined implicit conversion? That's... kind of cool though the opposite idea. Never heard of it till I just googled it:

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/implicit

I think the issue pops up the most (or only) when you divide by an int, even when you intend to have float precision. So if you're doing something like dividing by the TILE_WIDTH (int, pixels in a tile) but want the fractional part, it goes poof.

Polybios

I had one bug where I accidentally had typed something like a*+b in a more complex formula all written without spaces :-X. I meant a+b but it took me hours to spot it and I wondered that it was even valid.

l j
Polybios said:

I had one bug where I accidentally had typed something like a*+b in a more complex formula all written without spaces :-X. I meant a+b but it took me hours to spot it and I wondered that it was even valid.

I think it's valid because there is one binary(multiplication) and one unary(unary +) operator there. Not sure what the unary + operator is useful for though... At least in most languages, in JS it's used to convert a value to a Number.

My most annoying bug is probably where I typed 1 instead of l using a typeface that rendered the characters exactly the same.

Edgar Reynaldo

Get back in your box. >:(

<box>
bambams
</box>

AramisL

:'( I'm the mother of all the bugs in my programs

Chris Katko

I Am a Strange Loop

Edgar Reynaldo
People are strange when you're a stranger
Faces look ugly when you're alone
Women so wicked when you're unwanted
Streets are uneven when you're down
When you're strange...

Peter Hull

How about this one from the set up code for a microcontroller?
{"name":"611457","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/c\/0ce42c19bfd4921153a58458715a576d.png","w":462,"h":201,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/0\/c\/0ce42c19bfd4921153a58458715a576d"}611457
I didn't make it but I did find it after a lot of staring at the screen. :-/

bamccaig

I ... cannot see that one. It must require domain-specific knowledge?

Audric

portb_init is probably the default value for PORTB, but it overwrites PORTA instead.

bamccaig

Ah, good catch. By then my eyes must have been lazy. I missed that.

Mark Oates

I didn't make it but I did find it after a lot of staring at the screen. :-/

:D I caught it. It's lol approved.

Thread #617399. Printed from Allegro.cc