Skip to content

Build and compute the same on MSVC - #69

Merged
Force67 merged 7 commits into
mainfrom
msvc-float-math
Sep 26, 2026
Merged

Force67 merged 7 commits into
mainfrom
msvc-float-math

Conversation

@Force67

@Force67 Force67 commented Sep 26, 2026

Copy link
Copy Markdown
Owner

rx main stopped compiling under MSVC after the STL removal (#66), and would have computed differently where it did.

  • float math: std::sin(float) and friends had become ::sin(float). libstdc++'s <math.h> maps that to the float overload; MSVC's <math.h> has only the C double function, so it narrowed (errors) or silently ran the math in double. 1346 calls with all-float arguments, located by the compiler (float overloads that name themselves, compiled against a C-only <math.h>), now call the float function std::sin(float) calls (sinf, sqrtf, fabsf, ...); abs on floating values is fabs/fabsf (C's abs is the int one); 3-argument hypot, which C lacks, is rx::Hypot, step for step libstdc++'s. Linux is unchanged: GCC's front-end tree of every changed file resolves each rewritten call to the float overload before the change. A C-only <math.h> scan of rx now matches the libstdc++ build.
  • window_sdl3.cc and path_tracer.cc had helper includes inside Linux-only / NRD-only #if blocks.
  • script_string.h: HashStr and view() could never be constant expressions over base::StringRef (MSVC C3615), and a base::String was ambiguous to ScriptStringView under MSVC.
  • AssetId: a defaulted operator<=> needs ; its four orderings are spelled out.
  • tcp_stream.cc: under UNICODE gai_strerror is the wide variant (already broken before Replace the STL with equilibrium base and build without exceptions #66).
  • world streaming: near is a <windows.h> macro; the band field and locals are renamed.
  • mingw-shims gains WinSock2.h for zetanet.
  • equilibrium bumped for fix(base): keep <windows.h> out of the lock and file headers equilibrium#22 (no <windows.h> through the lock and file headers).

Verified: a full MSVC build of anyvoxel with rx, zetanet, kinema (Force67/kinema#2) and libultragui links (anyvoxel CI windows-x64, via a temporary probe PR); ctest 153/153 under vkrun and all runtime/scenes captures pass rxdiff on Linux.

@Force67
Force67 merged commit 7023146 into main Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant