Link Windows exe statically, change location of std::flush

The Windows exe has to be linked statically, because Windows
is stupid and doesn't have dynamic libraries like the stdc++ lib
available. Maybe it's in some .dll somewhere, but I can't be
bothered. Linux is just better.

The change to the location of flush will make the output look
more "spigot"-like, ie with large numbers of digits generated,
the digits will be output in small groups instead of a nice
smooth digit at a time. For some reason this is how most
spigot algorithms do it, and so to me it "looks" correct. It
doesn't actually change anything whatsoever other than when
the standard output actually gets printed to console.
This commit is contained in:
A.M. Rowsell 2023-06-20 17:55:09 -04:00
parent 97018305fd
commit bc12d981d0
Signed by: amr
GPG key ID: 0B6E2D8375CF79A9
2 changed files with 4 additions and 3 deletions

View file

@ -2,7 +2,7 @@ CC=x86_64-w64-mingw32-gcc
CXX=x86_64-w64-mingw32-g++
RM=rm -f
CPPFLAGS=-Wall
LDFLAGS=
LDFLAGS=-static
LDLIBS=-lm
SRCS=main.cpp Spigot.cpp

View file

@ -39,7 +39,7 @@ void Spigot::pump(void) {
// output all predigits
long unsigned pdLen = this->preDigits.size();
for(long unsigned int j = 0; j < pdLen; j++) {
std::cout << this->preDigits.back() << std::flush;
std::cout << this->preDigits.back();
this->preDigits.pop_back();
}
this->preDigits.insert(this->preDigits.begin(), tempPreDigit);
@ -50,7 +50,7 @@ void Spigot::pump(void) {
tempPreDigit = 0;
long unsigned pdLen = this->preDigits.size();
for(long unsigned int j = 0; j < pdLen; j++) {
std::cout << (this->preDigits.back() + 1) % 10 << std::flush;
std::cout << (this->preDigits.back() + 1) % 10;
this->preDigits.pop_back();
}
this->preDigits.insert(this->preDigits.begin(), tempPreDigit);
@ -60,5 +60,6 @@ void Spigot::pump(void) {
} catch (int e) {
std::cout << "An exception " << e << " occurred." << std::endl;
}
std::cout << std::flush;
return;
}