Should TIME be signed or unsigned?

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
Soruk
Posts: 23
Joined: Mon 30 Jul 2018, 20:24

Re: Should TIME be signed or unsigned?

Post by Soruk »

RichardRussell wrote: Wed 02 Sep 2020, 16:52
Soruk wrote: Wed 02 Sep 2020, 12:05 On Linux (EDIT: The same code works on my Windows builds)
On Linux, yes, but clock_gettime is not available in Windows (if it seems to be for you, it's probably because you are using cygwin or msys2 rather than the native msvcrt library).
I use Cygwin as my build environment as it's more comfortable for me to work with. I build using MinGW (to create a "native" Windows binary, so as not to create a dependency on cygwin1.dll) which is what is providing this interface and translating the Unix/Linux system calls to Windows ones. It's probably safe to say my code would collapse in a heap if I tried to build it on a Microsoft compiler!
RichardRussell

Re: Should TIME be signed or unsigned?

Post by RichardRussell »

Soruk wrote: Wed 02 Sep 2020, 21:04It's probably safe to say my code would collapse in a heap if I tried to build it on a Microsoft compiler!
It's not the compiler that matters (I don't use a Microsoft compiler either, I can't anyway because I need the long double data type which it doesn't support) but rather which C run-time library you use.

BBC BASIC for Windows is compiled using GCC, but to keep the runtime engine as small as possible (it's about 82 Kbytes) I don't statically link any libraries but instead use the native system C run-time which comes as standard with Windows: msvcrt.dll.
Soruk
Posts: 23
Joined: Mon 30 Jul 2018, 20:24

Re: Should TIME be signed or unsigned?

Post by Soruk »

RichardRussell wrote: Thu 03 Sep 2020, 00:24
Soruk wrote: Wed 02 Sep 2020, 21:04It's probably safe to say my code would collapse in a heap if I tried to build it on a Microsoft compiler!
It's not the compiler that matters (I don't use a Microsoft compiler either, I can't anyway because I need the long double data type which it doesn't support) but rather which C run-time library you use.

BBC BASIC for Windows is compiled using GCC, but to keep the runtime engine as small as possible (it's about 82 Kbytes) I don't statically link any libraries but instead use the native system C run-time which comes as standard with Windows: msvcrt.dll.
I was wondering how you got your binaries so small...! Yes, the MinGW C library will make the file rather larger, but I feel that's a small price to pay for the rather better portability I gain from doing so. (Not that I haven't run into some hiccups...)