|
Issues I found:
1. It doesn't even set anything
2. It uses Long (Int64) while the constructor takes Integer (Int32)
3. Declares a temporary variable to be returned the next line
4. Why is it dTemp2?
My way (I will keep the same name, mainly because I can't think of any other):
Function SetDate(ByVal nYear As Int32, ByVal nMonth As Int32, ByVal nDay As Int32, ByVal nHour As Int32, ByVal nMinute As Int32, ByVal nSecond As Int32) As Date
Return New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
End Function
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|
|
His calls to this function are to set a date variable = function call. He literally used this function for nothing. My solution was :
myVariableName = new Date(..yada..yada..yada...)
Zac Greve wrote: It uses Long
Every numeric variable he declaired in the entire project was a long.
If it moves, compile it
|
|
|
|
|
I'd rather that then the people who use strings for everything...*shudder*
|
|
|
|
|
GibbleCH wrote: *shudder*
Shiver, shake, and convulse!
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|
|
Well, at least he wasn't stringing you along.
GROAN!
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|
|
It seems to me that you are turning regular expressions into puns for amusement.
If it moves, compile it
|
|
|
|
|
I am just trying to move this thread along, but it seems that it is not synchronizing.
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|
|
I'm starting to see a pattern emerge here.
If it moves, compile it
|
|
|
|
|
It's obvious this guy added the SetDate implementation to a class that implements the IDateRepository in order to facilitate dependency injection and the factory pattern! All the better I say. Should minimize the impact of the Y3K bug and enable unit testing of date functionality against realistic data.
|
|
|
|
|
Let me guess: that guy used to work with VB6, and now he ports many "useful" functions from his year-long experience to VB.NET.
|
|
|
|
|
Yes. He fought using .net in the first place, would not attempt to learn c#, and forces everything to work as if it were still vb6.
If it moves, compile it
|
|
|
|
|
Fire him! No Luddites allowed!!!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
When i was beggining to make some programs i had to make a small ellectronic book in c++. It started ok, i managed to make a reader and an editor and then came the worst error a programmer can have. When I compiled the program it went smoothly but when i openned it from windows it showed and internal error message whit no message. I suspected it was an I/O error because when i copied the program to c: or d: didnt showed the error but when i placed in other folder that wasnt the root it showed the error message
|
|
|
|
|
the ide was c++ builder 6
|
|
|
|
|
Not really a C++ myself but I was under the impression Borland Builders were one the best.
I was under the impression that the Microsoft versions were created and then Microsoft created the standards to fit, my experience of VC++ is you type a quick test program spend an age trying to figure out why it wont compile, get fed up use Builder6 load the code press F9 away you go!
|
|
|
|
|
If it's Builder 6 turn on CodeGuard. Run the application and then look at the code guard log. There's a decent chance it will just tell you what's wrong. It could be as simple as an assumption about paths and/or permissions. It could even be an issue of finding DLL's
|
|
|
|
|
It's just as well you've had an error like this - hopefully if/when you fix it, you'll have a more structured method for debugging in the future. It is not a good idea to write code with the approach of build and run it hoping it works; you have no idea what could be going wrong under the surface.
If I was faced with an empty error dialog, I think my approach would be as follows (Apologies in advance, I'm not familiar with C++ Builder 6)
- Track down 'when' the error occurs. We know it happens as you open the program, so try building some more useful output into the program. It sounds like you're unable to debug line-by-line, so I'd try bringing up an output dialog each time something works properly - print some useful text to say what was done, etc.
- Find the offending operation/function that is causing the issue. With the information you've provided, I'd keep an eye out for any file loading stuff that may be involved; perhaps your file loader can only handle absolute paths and it's being fed relative ones.
- Replace the suspect code with a simple test - instead of trying to load a file, perhaps output a "Loading file [path+filename]" message. If it doesn't come up with the blank dialog anymore, you know which line causes the issue. I'm far more used to debugging by pressing F10 until it breaks in Visual Studio, so this is effectively a more long-winded approach to doing the same thing.
- Fix the offending code. Naturally, you still need to be able to load the file; I'm unfamiliar with your program's requirements, but if it's plain C++ loading a data file (binary or text, usually) then you should have no problems using an input stream[ ^]. I can promise you that this definitely works, and won't give you blank error messages.
If you find errors in your code, it shouldn't matter if you get nonsensical or unhelpful messages - that's often the flavour of the day when it comes to programming. You need to break it down into each step to find out what's wrong, which inherently helps you understand your own code (or other people's code) better.
Happy hunting!
Sometimes a fist in the face says more than a thousand honeyed words.
|
|
|
|
|
I started C programming in Borland's Turbo C/C++ compiler . I didn't reall start C++ until Microsoft's Visual C++ v4.0 .
I love C++ but after learning other languages and delving into functional programming, I can see why some people might hate it.
Interesting post, by the way.
|
|
|
|
|
Not sure what you're saying exactly, but one of the worst things IMHO, that a programmer can think is that program compilation has anything to do with program operation.
|
|
|
|
|
yes i know that but imagine that you cant trace an error because when you debug the executable it doesnt show up,
what would you do?
|
|
|
|
|
Usually that means that there are environmental differences between your DEBUG running and the running that produces the errors. You need to figure out how to isolate these differences and determine why they are the cause of the error. Sometimes the addition of a logfile to write entries to, can help you narrow down the code that is failing.
Oh and this isn't something that just happens to C++. It can happen with other languages too.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
yes I know but at least in managed languages you get a nice error message not a blank error messsage, thats why I hate c++
|
|
|
|
|
And what if that useless message comes out of some library or DLL you are using? How is C++ responsible for that?
One thing is almost certain: You have some unclean code somewhere in there which you get away with in a debug build, but not in a release build. Like it or not, but you are going to have to find that code and then fix it.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
there is no release and no debug, just a regular .exe that when is run from the IDE to debug it goes fine, but when you click it on windows it goes wrong
|
|
|
|
|
Ouch buddy, you don't even know what are you talking about
It must have to be either debug version or release version. as CDP1802 says, clean your code and stop complaining. and also try to figure out what is the differences and what is missing.
|
|
|
|