Closed GoogleCodeExporter closed 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
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
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
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
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
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
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
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
Original comment by dbzhang...@gmail.com
on 16 Mar 2012 at 8:22
Original issue reported on code.google.com by
bengt.ni...@spray.se
on 28 Mar 2010 at 8:59