SOLVED: VSI C X7.4-785 on OpenVMS V9.2-1 can't name a variable readonly.

Post Reply

Topic author
pocketprobe
Valued Contributor
Posts: 76
Joined: Sat Apr 15, 2023 11:53 pm
Reputation: 0
Status: Offline

SOLVED: VSI C X7.4-785 on OpenVMS V9.2-1 can't name a variable readonly.

Post by pocketprobe » Mon Sep 11, 2023 11:48 pm

This one was discovered trying to build lynx on x86, and this short example triggers the issues.

Code: Select all

#include <stdio.h>

int main(int argc, char *argv[])
{
        int readonly = 0;
        puts("Enter a number: ");
        getch(&readonly);
        printf("Your number is %i\n", readonly);
        return 0;
}

Code: Select all

$ cc test.c

        int readonly = 0;
.....................^
%CC-E-DECLARATOR, Invalid declarator.
at line number 5 in file DISK$USERS:[TEMP]TEST.C;1

        getch(&readonly);
...............^
%CC-E-BADEXPR, Invalid expression.
at line number 7 in file DISK$USERS:[TEMP]TEST.C;1

        printf("Your number is %i\n", readonly);
......................................^
%CC-E-BADEXPR, Invalid expression.
at line number 8 in file DISK$USERS:[TEMP]TEST.C;1
$ cc /version
VSI C X7.4-785 (GEM 50X65) on OpenVMS x86_64 V9.2-1
Last edited by pocketprobe on Tue Sep 12, 2023 2:38 pm, edited 2 times in total.

User avatar

martinv
Master
Posts: 104
Joined: Fri Jun 14, 2019 11:05 pm
Reputation: 0
Location: Goslar, Germany
Status: Offline
Contact:

Re: SOLVED: VSI C X7.4-785 on OpenVMS V9.2-1 can't name a variable readonly.

Post by martinv » Tue Sep 12, 2023 4:48 am

According to the VSI C Language Reference Manual, readonly is a VAX C keyword that is recognized as such by the compiler if /STANDARD=RELAXED (the default) or /STANDARD=VAXC or /ACCEPT=VAXC_KEYWORDS is specified on the command line.

Try compiling using e.g. /STANDARD=ANSI89 or /ACCEPT=NOVAXC_KEYWORDS
Last edited by martinv on Tue Sep 12, 2023 4:50 am, edited 1 time in total.
There is something wrong with everything that is popular.
(Charles Fort)


sms
Master
Posts: 374
Joined: Fri Aug 21, 2020 5:18 pm
Reputation: 0
Status: Offline

Re: SOLVED: VSI C X7.4-785 on OpenVMS V9.2-1 can't name a variable readonly.

Post by sms » Tue Sep 12, 2023 9:51 am

Code: Select all

> [...] /ACCEPT=NOVAXC_KEYWORDS

   That's probably the best approach.  A less classy work-around would
be to hide the offensive name:

      /define = "readonly=nowrite"


> VSI C X7.4-785 on OpenVMS V9.2-1 [...]

   I got the same (expected) behavior on IA64 with, for example:

its $ cc /version
VSI C V7.4-001 on OpenVMS IA64 V8.4-2L3


Topic author
pocketprobe
Valued Contributor
Posts: 76
Joined: Sat Apr 15, 2023 11:53 pm
Reputation: 0
Status: Offline

Re: SOLVED: VSI C X7.4-785 on OpenVMS V9.2-1 can't name a variable readonly.

Post by pocketprobe » Tue Sep 12, 2023 2:38 pm

Thank you all. I had checked the release notes, but not the other wasn't aware of the other documentation that was referenced here. Looks like there are a few other build issues with lynx that I will have to investigate now.

User avatar

arne_v
Master
Posts: 374
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: SOLVED: VSI C X7.4-785 on OpenVMS V9.2-1 can't name a variable readonly.

Post by arne_v » Tue Sep 12, 2023 8:15 pm

I would consider renaming that variable.

readonly is a word that is screaming out loud "I am a candidate for reserved word".
Arne
arne@vajhoej.dk
VMS user since 1986

Post Reply