|
A similar thing happened quite a few years ago on a system on of our clients had from a different supplier, which was an Access database - they started getting numeric overflow errors and the original supplier wanted lots of time and money to investigate and fix the problem as it was out of paid support. I asked the user if there were 32,767 records in the main table and he was astonished at my correct guess.
I changed the autonumber column in the main table from a short integer to a long integer and said that he could buy me a pint on my next site visit. Lots of brownie points were also awarded by the client.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
I had to fix a similar issue back in the 90s, when the table of accounts in our database exceeded the number we could import to an Excel sheet (16384?).
|
|
|
|
|
Here's[^] one of my favourite Halls of Shame.
|
|
|
|
|
Private Function getMonthByCode(ByVal code As String) As Integer
Select Case code
Case "JUL"
Return 7
Case "SEP"
Return 9
Case Else
Return -1
End Select
End Function
|
|
|
|
|
Duncan Edwards Jones wrote:
Private Function gGetMonthByCode(ByVal code As String) As Integer
Select Case code
Case "JUL"
Return 7
Case "SEP"
Return 9
Case Else
Return -1
End Select
End Function Fixed
I'll ignore the fact that it's VB as I like VB (not this particular piece though)
|
|
|
|
|
Duncan Edwards Jones wrote: I'm guessing there are two unit tests for this No, three: don't forget to test for FILE_NOT_FOUND.
|
|
|
|
|
Maybe the code is only in "alpha state" for now.
I miss a comment like:
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Wow. Just two? I can think of at least three more.
|
|
|
|
|
Did you intend to reply to KarstenK or the OP?
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Should have been the OP. Oops.
|
|
|
|
|
It happens.
One site I was on had a developer add a "feature" that caused forum replies to be attached to a random post. He said that it was supposed to "liven up the forums". I don't think he works for that site anymore.
I'd post a link, but this was several years ago, and I can't remember what site it was.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Brisingr Aerowing wrote: One site I was on had a developer add a "feature" that caused forum replies to be attached to a random post. He said that it was supposed to "liven up the forums". I don't think he works for that site anymore.
Uhhhh.... yeah. How was that supposed to "liven up the forms"? The only way we're ever going to know that is to find out what drugs he was on and get some.
|
|
|
|
|
Makes sense if the only valid input is JUL or SEP
|
|
|
|
|
Porting some C code to one microcontroller to another I found this:
if((error == 0)
#ifdef SENSAR
|| (V_OK == 0))
#else
)
#endif
This work is unhealthy
|
|
|
|
|
How else would you do it? Other than, of course, eliminating the #else by putting the right-parenthesis outside the #if .
|
|
|
|
|
leaving V_OK = 0 whenever you don't define SEANSAR maybe.
If I could I would put all the code here for you to see what I have to strugle every day. There are violations to every single "good programing practice", starting for the encapsulation, with a lot of variables and defines mixed in separated and "isolated" modules.
|
|
|
|
|
But this way eliminates a test when you don't have SENSAR; ergo it's FFFAAASSSTTTEEERRR...
Why test something that's always true?
|
|
|
|
|
Maybe, but this things makes the code unclear and dificults the scalability.
Anyway you are right in the fact that it is faster, innecesarily and almost insignificaly faster
|
|
|
|
|
But when working with microcontrollers performance and memory management are important, aren't they?
And many small things might lead to a noticeable gain in that.
|
|
|
|
|
I was going to say that. Sometime had to do weird trick, that looked really ugly, just to save program memory (PIC16F84)
I do not fear of failure. I fear of giving up out of frustration.
|
|
|
|
|
You're absolutely right. You ought to write it more concise:
if((error == 0)
#ifdef SENSAR
|| (V_OK == 0)
#endif
) Much cleaner now!
|
|
|
|
|
I would have write it that way.
#ifdef SENSAR
if((error == 0) || (V_OK == 0))
#else
if((error == 0))
#endif
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
I have to agree, it is easier to read that way.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
still has double parentheses on the 2nd case. That will slow the compiler massively
|
|
|
|