Mr-Ntic / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

lastError implementation missing #50

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use lastError() method in my code
2. Compile& Build

What is the expected output? What do you see instead?
Successful build expected.
lastError not found during link

What version of the product are you using? On what operating system?
1.2.0
MacOSX 10.6.2

Please provide any additional information below.

Looking in the code, I see no implementation of the method lastError();
It is in the headers under section public, so it compiles but it does not link.
It's been a while since I updated to latest version, but it did work before.
Having said that, I am not sure how well it WORKED on Mac, but it did build.

BN

Original issue reported on code.google.com by bengt.ni...@spray.se on 28 Mar 2010 at 8:59

GoogleCodeExporter commented 8 years ago
I edited qextserialport.h:

//ulong lastError() const;
    ulong lastError() {return lastErr;};

If this is not desirable, please tell me why and I will not use lastError() in 
the future.
If it is ok, please include this in the standard source.

BN

Original comment by bengt.ni...@spray.se on 28 Mar 2010 at 2:18

GoogleCodeExporter commented 8 years ago
Now, as it is, lastErr is always = E_NO_ERROR, because nothing calls
translateError(), which sets that variable. As such, errorString() always 
returns "No
Error has occurred".

Original comment by ronanpaixao@gmail.com on 11 Apr 2010 at 5:43

GoogleCodeExporter commented 8 years ago
Thanks for this information.
De-funct or not, I think the implementation should be there for backward 
compatibility, whith a compile-time 
warning.

What error-detecting mechanisms are used nowadays?

BN

Original comment by bengt.ni...@spray.se on 12 Apr 2010 at 6:26

GoogleCodeExporter commented 8 years ago
The problem is not about having a defunct function, but because it is defunct. 
It
should be used. As it is now, even if something returns an error, the error 
message
always says that there was no error, because errorString() depends on the 
lastErr
variable, which is never set.

Original comment by ronanpaixao@gmail.com on 15 Apr 2010 at 1:26

GoogleCodeExporter commented 8 years ago
So the conclusion is that it is desirable that this problem should be fixed 
evenually?

Original comment by bengt.ni...@spray.se on 15 Apr 2010 at 6:58

GoogleCodeExporter commented 8 years ago
The conclusion is that functions that return on error set the lastErr variable 
in
addition to just returning a true/false value.

Original comment by ronanpaixao@gmail.com on 15 Apr 2010 at 12:24

GoogleCodeExporter commented 8 years ago
Sorry, I don't understand. You just said that LastErr is never changed?
And it is still not clear to me wether the missing lastError() implementation 
will be added in the source or not.

Original comment by bengt.ni...@spray.se on 15 Apr 2010 at 12:53

GoogleCodeExporter commented 8 years ago
Sorry, my bad. I saw that translateError (where most of lastErr setting is 
done) is
never called, so I generalized. Anyway, lastErr is not getting set in some very
important places, most notably in open() on the Windows implementation. In 
fact, it's
only set on readData() and writeData(). As it is, the open() method returns the 
right
(boolean) value, but using errorString() gives me a message as if no error 
occurred.

Original comment by ronanpaixao@gmail.com on 18 Apr 2010 at 1:19

GoogleCodeExporter commented 8 years ago

Original comment by dbzhang...@gmail.com on 16 Mar 2012 at 8:22