-3

I am doing some emnedded work for which I am writing program in CPP. My machine has dos platform. In my program I am using long long keyword which is not working.I am using turboC++ 3.2 compiler.

I have searched a lot and find C99 library has stdint.h file but how can i use this file with my compiler. Or some other comiler to work on embedded keywords which made dos based executable file.

  • 1
    Please clarify "long long keyword which is *not working*". Is it compiling? Does it not have the expected range? Does it only work for even numbers? – Thomas Matthews Jul 13 '17 at 15:45
  • 5
    The ancient compiler you're using doesn't support the `long long` type nor does it support any 64-bit integer type. You'll need to port the program to use 32-bit integer types (or maybe a floating-point type). That may mean writing your own code to do 64-bit arithmetic using 32-bit integers. – Ross Ridge Jul 13 '17 at 15:45
  • 1
    Why Turbo C++? That's ancient and doesn't support any of the new C++ standards. If you're writing embedded code you'll want the best compiler you can get to crank out the most optimized, minimal binary. – tadman Jul 13 '17 at 15:45
  • @tadman Probably working on some legacy product would be my guess so they might not have a choice. – Javia1492 Jul 13 '17 at 15:47
  • @Javia1492 There's been a rash of these "Turbo C++" questions lately, so I'm trying to figure out why. Even then, there are vastly better compilers for doing legacy work, like Open Watcom. – tadman Jul 13 '17 at 16:02
  • 2
    @tadman: Indian schools teach use of Turbo C++ on DOS. – Lightness Races in Orbit Jul 13 '17 at 16:07
  • @ThomasMatthews yupes it is compiling but it's range is of unsigned long. – Saurabh Gupta Jul 13 '17 at 16:07
  • @LightnessRacesinOrbit That would explain. I have no idea why they'd subject people to this and expect them to learn anything about proper C++ development. C++ in the 1990s was an ugly beast. – tadman Jul 13 '17 at 16:10
  • The guy who ported Retro City Rampage to DOS [talks about his experience with DOS compilers](http://www.gdcvault.com/play/1023270/From-PS4-to-1-44MB) and working within really tight memory limits. Working within those super tight constraints is the sort of thing most people spend their entire career trying to avoid. – tadman Jul 13 '17 at 16:13
  • Just a minor point. `long long` is not a keyword; it's two keywords, both of them being `long`. – Pete Becker Jul 13 '17 at 16:32
  • If you switch to a modern compiler, like GNU, Microsoft, IAR, Greenhills, etc., you could use either `int64_t` or `uint64_t` from `stdint`. There are free modern compilers you can download, so no reason to use Turbo C++. – Thomas Matthews Jul 13 '17 at 17:56
  • Open Watcom supports DOS targeting *and* `long long`. – Cody Gray Jul 14 '17 at 05:18

2 Answers2

4

You are using a platform from the 1980s, before C++ even existed as a standard. Even your int is only 16-bit.

It's not clear what you want to use long long for but if you're after a 64-bit type you're out of luck. Either way, your compiler simply does not support this type. You'll have to come up with a workaround that does not require use of this type.

Or use a compiler from now times.

Lightness Races in Orbit
  • 358,771
  • 68
  • 593
  • 989
-2

Instead of writing long long, try writing long long int . Assumption : The error generator echoes that long long is not recognised.

Deceptor
  • 26
  • 2