Thread: Appropriate wxLongLong method?

Appropriate wxLongLong method?

From
"Hiroshi Saito"
Date:
Hi Andreas.

Now, am only I strange?

base/base.cpp: In function `wxString NumToStr(wxLongLongNative)':
base/base.cpp:130: cannot pass objects of non-POD type `class wxLongLong'
   through `...'
gmake[2]: *** [base.o] error 1
gmake[1]: *** [all-recursive] error 1
gmake: *** [all] error 2

--- src/base/base.cpp.orig      Thu Sep  8 21:37:15 2005
+++ src/base/base.cpp   Thu Sep  8 21:37:15 2005
@@ -30,7 +30,7 @@
 #define atolonglong(str) strtoll(str, (char **)NULL, 10)
 #else
 #ifdef __FreeBSD__
-#define atolonglong(str) strtoll(str, (char **)NULL, 10)
+#define atolonglong(str) strtoll(str, NULL, 10)
 #else
 #define atolonglong atoll
 #endif

It was required for me. Probably, #undef atolonglong may also be necessity.
However, Should not the origin of the wxLongLong method of wxWidget be changed?

Regards,
Hiroshi Saito






Re: Appropriate wxLongLong method?

From
Andreas Pflug
Date:
Hiroshi Saito wrote:
> Hi Andreas.
>
> Now, am only I strange?

I don't know... :-)

>
> base/base.cpp: In function `wxString NumToStr(wxLongLongNative)':
> base/base.cpp:130: cannot pass objects of non-POD type `class wxLongLong'

Very weird. This has to be checked with your compiler, together with
wxLongLongFmtSpec. For my 2.6 Linux with gcc3.4, wxLongLongFmtSpec is
"ll" (ell-ell), so the resulting printf format string is %lld, requiring
a long long passed by value as argument. Apparently there's some
mismatch for your compiler.


>  #else
>  #ifdef __FreeBSD__
> -#define atolonglong(str) strtoll(str, (char **)NULL, 10)
> +#define atolonglong(str) strtoll(str, NULL, 10)
>  #else

More weird. What's the required argument for strtoll for your platform?
I'm quite sure the (char**) cast was invented to match system header's
needs, so other FreeBSD versions might fail after your patch.

Regards,
Andreas