6

I'd like to know if it's possible to make VC++ use LP64 instead of LLP64, I know I could use another compiler such as GCC or Intel C++, but I'd like to use VC++ for various reasons.

There is no requirement for compatibility with Microsoft headers, etc, and I am already using LIBC as my runtime library.

James
  • 1,569
  • 10
  • 18
  • 1
    Why? If you need a 64-bit integer, just use `int64_t`. – James McNellis Mar 31 '12 at 06:15
  • 2
    Using that logic, there's no need for `long`, `long long` or `short` :| – James Mar 31 '12 at 06:16
  • If you require an integer type with a particular width, you should use the specific fixed-width integer type. That's what these types are for. – James McNellis Mar 31 '12 at 06:17
  • 2
    As stated, that logic renders no legitimate use for `short`, `long` or `long long` and a plain `char` type. I'm simply asking how to tell VC++ to use `LP64` instead of `LLP64`. The opposite can be done with GCC using `-mlong32`. – James Mar 31 '12 at 06:28
  • 7
    You can't. End of story. – Hans Passant Mar 31 '12 at 06:39
  • you can use `int_fast64_t` or `int_least64_t` if you don't like fixed-width – phuclv Nov 28 '14 at 07:00
  • Microsoft did it for the Win64 port of (now dead) "Subsystem for UNIX-based Applications" (= Interix), which is using the Visual C++ compiler albeit through a convoluted way of calling: the `c89` script calls an helper program, named `l2ll` on every source file before feeding them to the `cl` compiler. The tool itself is discussed in a few place on the web. Besides the obvious replacement of long keyword, it also amend(ed) the L suffix for constants... There is no documentation for it, and of course the source is not available. So it is certainly possible; it just neither easy nor pretty. – AntoineL Jan 26 '15 at 14:12

2 Answers2

3

Sometimes "You can't" is also an answer. Because it's not possible (allegedly for backwards compatibility).

Use portable types instead (#include <cstdint>):

  • int8_t - a 8-bit integer
  • int16_t - a 16-bit integer
  • int32_t - a 32-bit integer
  • int64_t - a 64-bit integer

P.S. As a possible workaround you could use Cygwin, which uses LP64 even on Windows.

Community
  • 1
  • 1
rustyx
  • 80,671
  • 25
  • 200
  • 267
-2

you can try to use

\#define long long long

or

/Dname[= | # [{string | number}] ]

so try

/Dlong="long long"

but this could be dangerous

fthiella
  • 48,073
  • 15
  • 90
  • 106
  • 3
    This will just break every system call and calls to other libraries, aside from being a really bad coding practice. Don't do it. Note that it will replace existing occurrences of "long long" with "long long long long". – rdb Sep 30 '15 at 13:28