OpenVMS C++ language reference?

Post Reply

Topic author
garyrevell
Active Contributor
Posts: 38
Joined: Thu Nov 19, 2020 7:15 am
Reputation: 0
Location: Basingstoke, UK
Status: Offline
Contact:

OpenVMS C++ language reference?

Post by garyrevell » Sun Nov 29, 2020 8:58 am

Hi,

I see there's an OpenVMS C language reference but no C++ language reference, I'd imagine this isn't an oversight so what guide should be used for reference?

For example I'm trying to use a simple auto for loop to see what I can do but I'm getting errors... :(

https://en.cppreference.com/w/cpp/language/range-for

I'm trying to use the C++11 standard but not sure what compiler args I need?

Code: Select all

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    std::vector<int> v = {0, 1, 2, 3, 4, 5};

    for (auto i : v)            // access by value, the type of i is int
        cout << i << ' ';
    cout << '\n';

    return 0;
}
Errors:

Code: Select all

    std::vector<int> v = {0, 1, 2, 3, 4, 5};
.........................^
%CXX-E-BRACEINIT, initialization with "{...}" is not allowed for object
          of type "std::vector<int, std::allocator<int>>"
at line number 8 in file MYROOT:[dev.cxx]auto.cxx;4

    for (auto i : v)            // access by value, the type of i is int
..............^
%CXX-W-NOSIMPINT, omission of explicit type is nonstandard ("int" assumed)
at line number 10 in file MYROOT:[dev.cxx]auto.cxx;4

    for (auto i : v)            // access by value, the type of i is int
................^
%CXX-E-EXPSEMICOLON, expected a ";"
at line number 10 in file MYROOT:[dev.cxx]auto.cxx;4

    for (auto i : v)            // access by value, the type of i is int
...................^
%CXX-E-EXPPRIMEXPR, expected an expression
at line number 10 in file MYROOT:[dev.cxx]auto.cxx;4

    for (auto i : v)            // access by value, the type of i is int
...................^
%CXX-E-EXPSEMICOLON, expected a ";"
at line number 10 in file MYROOT:[dev.cxx]auto.cxx;4

%CXX-I-MESSAGE, 4 errors detected in the compilation of "MYROOT:[dev.cxx]auto.cxx;4".
Thanks in advance.

Gary

User avatar

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

Re: OpenVMS C++ language reference?

Post by arne_v » Mon Nov 30, 2020 9:33 pm

https://vmssoftware.com/products/documentation/ only has User Guide and Class Library Reference Manual.

VMS C++ is pretty old. You should not expect it to support C++ 11. Try C++ 98.

Added in 31 minutes 13 seconds:
I checked the SPD and it says:

VSI C++ for OpenVMS is based on the ANSI/ISO C++ International Standard, reference designation number ISO/IEC 14882:1998.
Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
garyrevell
Active Contributor
Posts: 38
Joined: Thu Nov 19, 2020 7:15 am
Reputation: 0
Location: Basingstoke, UK
Status: Offline
Contact:

Re: OpenVMS C++ language reference?

Post by garyrevell » Tue Dec 01, 2020 3:42 am

arne_v wrote:
Mon Nov 30, 2020 10:04 pm
https://vmssoftware.com/products/documentation/ only has User Guide and Class Library Reference Manual.

VMS C++ is pretty old. You should not expect it to support C++ 11. Try C++ 98.

Added in 31 minutes 13 seconds:
I checked the SPD and it says:

VSI C++ for OpenVMS is based on the ANSI/ISO C++ International Standard, reference designation number ISO/IEC 14882:1998.
Thanks Arne, it was a forlorn hope that I'd be able to do this.... :(

Oh well, I guess it's back to Java V1.8 for me then as at least I can use some of the functional programming techniques.

Regards

Gary

User avatar

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

Re: OpenVMS C++ language reference?

Post by arne_v » Tue Dec 01, 2020 9:48 am

Or Kotlin.

I got a standard Kotlin running on Java 8 on VMS I64.
Arne
arne@vajhoej.dk
VMS user since 1986


jreagan
VSI Expert
Master
Posts: 134
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: OpenVMS C++ language reference?

Post by jreagan » Tue Dec 01, 2020 11:08 am

Yes, as Arne said, the Itanium C++ compiler is C++03 (and even that might have issues). Using "auto" in this fashion is new with C++11.

We'll have a better C++ on x86 since we're using clang as our C++ product. We have no plans on any updates to the Alpha or Itanium C++ compilers.

User avatar

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

Re: OpenVMS C++ language reference?

Post by arne_v » Tue Dec 01, 2020 6:49 pm

03 is 98 with 200 fixes and value initialization right?
Arne
arne@vajhoej.dk
VMS user since 1986


jreagan
VSI Expert
Master
Posts: 134
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: OpenVMS C++ language reference?

Post by jreagan » Tue Dec 01, 2020 9:58 pm

Sure, I'll go with that. Some of those fixes are to the STL, not the language. I had to fix (cut-n-paste changes from LLVM libcxx into our Itanium headers) some of the STL templates on Itanium in order to compile the LLVM 3.4.2 code base which claims to be C++03.

Post Reply