According to the documentation of OpenWatcom, CONST and CONST2 are read-only non-executable segments, string literals are put to CONST, and user-defined const global variables are put to CONST2. My question: what else does the OpenWatcom C compiler put to CONST? (And is it possible to configure it, e.g. so that only string literals go to CONST?)

I've discovered at least one thing: some floating-point constants are also added to CONST, for example in the function double mul3(double x) { return 3 * x; }, the output of the dmpobj tool indicates that the 8-byte constant 3 is put to CONST.

  • 8
    OpenWatcom is an active developed product, have you tried asking on their Forum, Reddit or Discord?
    – Raffzahn
    Commented Jun 3, 2023 at 5:38
  • 2
    Isn’t using current toolchains to target retro platforms on-topic? Commented Jun 5, 2023 at 11:00
  • 1
    The help center states questions are welcome on "hardware, including peripherals, and software, including operating systems and applications" but also states (slightly paraphrased to reduce character count, an attempt totally nullified by this parenthetical :-) ) "questions about modern, currently supported computers are off-topic, including questions about earlier versions of a current machine or OS". I suspect this question is considered OT due to that second quote. In any case, nothing in the question seems to refer to a retro platform
    – paxdiablo
    Commented Jun 7, 2023 at 1:19
  • 1
    @paxdiablo Re: referring to a retro platform, I don't see a "32-bit only" tag on the linked documentation, which indicates that the relevant options do apply to the wcc compiler and wcl compiler driver used for targeting DOS, Windows 3.1, and other supported 16-bit targets. On the other hand, it also appear to not be badged "16-bit only", meaning it is also applicable to the wcc386 compiler and wcl386 compiler driver, where modern Linux has been added alongside DPMI, Windows NT, and Windows 9x as a valid output target.
    – ssokolow
    Commented Jun 7, 2023 at 2:36


Browse other questions tagged .