This language bar is your friend. Select your favorite languages!

Idiom #160 Detect if 32-bit or 64-bit architecture

Execute f32() if platform is 32-bit, or f64() if platform is 64-bit.
This can be either a compile-time condition (depending on target) or a runtime detection.

begin
  {$ifdef cpu64}
  f64;
  {$endif}
  {$ifdef cpu32}
  f32;
  {$endif}
end.
import "strconv"
if strconv.IntSize==32 {
	f32()
}
if strconv.IntSize==64 {
	f64()
}

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org