[Info-vax] OpenVMS Development Annoyances
Simon Clubley
clubley at remove_me.eisner.decus.org-Earth.UFP
Sun Apr 7 19:47:55 EDT 2019
On 2019-04-07, Arne Vajhøj <arne at vajhoej.dk> wrote:
> On 4/7/2019 1:55 AM, John Reagan wrote:
>> As for platform-specific addons for descriptors, etc. Would you
>> rather have things added to std::string (like being able to ask for a
>> descriptor of the data) or a new vms::string that inherits from
>> std::string? I've play with both (and even considered C++17's
>> string_view) and none jump out as the "best".
I'm not 100% sure where it should be but I am 100% sure that it
should _NOT_ be in std::string. VMS specific APIs have no place
in std::{anything}, given the options available to you in C++.
[snip]
>
> But I also don't like vms::string inheriting from std::string. Either
> the application will use vms:string and VMS specific libraries all
> over or it will end up with a lot of copy constructor calls to get from
> std::string to vms::string. That type of inheritance is rarely good.
>
Inheriting does have some advantages if you want to extend this
approach to implement VMS specific functionality in other classes.
If the program is designed correctly (isolating the VMS specific
stuff from the rest of the program), I am not convinced the overhead
is as high as you think it could be.
> I will recommend the primitive solution:
>
> std::string s;
> vms::string_descriptor = vms::get_descrptor(s);
>
> No messing around with classes - just a simple function that does the job.
>
I'm not happy about that as it means that an unrelated class
potentially needs access to the internal implementation details
of the std:: classes.
In the case of std::string, you can argue that the information you
need to build the descriptor is available from public API information
but that might not be true for other VMS specific extensions to the
std:: classes.
I don't use C++ on VMS so I don't know if this is currently supported
by HPE C++, but one potential use might be to provide a marshalling
mechanism to marshall a vector (for example) to a VMS specific
variable length array descriptor.
Does HPE C++ currently support that, and if so, can the marshalling
be done in either direction ?
Simon.
--
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world
More information about the Info-vax
mailing list