mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #56] Question regarding return type for functions returning an lxw_error #48
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @utelle on GitHub (Jun 29, 2016).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/56
Originally assigned to: @jmcnamara on GitHub.
Many functions (like
workbookorworksheetfunctions) return anlxw_erroraccording to the documentation. However, the declared return type isuint8_tfor theworkbookfunctions resp.int8_tfor theworksheetfunctions.At the moment I have to use explicit type casts in my C++ application to avoid compiler warnings, when handling the error code returned from those functions.
Wouldn't it be better (and more logical and consistent) to use the enum type
lxw_erroras the return type for the functions in libxlsxwriter that return anlxw_error?@jmcnamara commented on GitHub (Jun 29, 2016):
Hi Ulrich,
I meant to do that when I was refactoring the error codes. I'll fix that soon.
Regards,
John
@utelle commented on GitHub (Jun 29, 2016):
Great news. Thanks.
@jmcnamara commented on GitHub (Jun 29, 2016):
Also, just to be sure I resolve this issue can you provide a small example program that generates the warning.
@utelle commented on GitHub (Jun 29, 2016):
Reproducing the error message is very easy. Just a simple line like the following in a C++ application
results in the following error message in VC++ 2010 (most probably in later versions, too) :
According to the MSDN documentation an explicit cast is required to convert from an integral type to an enumeration type.
@jmcnamara commented on GitHub (Jul 3, 2016):
Hi,
I've changed the return type of all public functions to
lxw_errorand refactored the code internally to always return it.You can try it when you get a chance.
Also, It would be useful if you could upload a sample MSVC 2010 project to GitHub to help anyone else who is trying to get it working. Could you do that? It doesn't have to be as elaborate as the MSVCLibXlsxWriter example: https://github.com/jmcnamara/MSVCLibXlsxWriter
John
@utelle commented on GitHub (Jul 3, 2016):
Great. I'll test it within the next few days.
I'm currently working on a wxWidgets wrapper for libxlsxwriter. I intend to publish it on GitHub in the not too far future. A sample will certainly be included, too.
I have a few more issues with the libxlsxwriter code, nothing serious (maybe partially again just MSVC 2010 related), but nevertheless I will open another issue for them.
@utelle commented on GitHub (Jul 4, 2016):
I removed the explicit
lxw_errortype casts from my own code ... and the code compiles flawlessly.Great. Thanks. Keep up the good work.
@jmcnamara commented on GitHub (Jul 4, 2016):
Fixed in release 0.4.0. Thanks for the report.