3 ms·
> And do all the C++ libraries take only smart pointers as arguments and return only smart pointers as return values? C++ libraries that would be as recent as
by jcelerier 9y ago
> And do all the C++ libraries take only smart pointers as arguments and return only smart pointers as return values?
C++ libraries that would be as recent as Rust libraries would certainly take things by value or reference so there would be no problems. I honestly don't know libraries with raw pointers in their APIs that aren't from the 90's or before; and I don't think you want to use those in a current product anyways.
- pjc50 9y agoThis is a little difficult on Windows or POSIX systems. Also, as others have pointed out, you can smart-pointerise everything, but still have problems with common tree and graph structures. Rust is rigorous. C++ isn't; I'm not aware of any mainstream compilers which even have the option to make use of bare pointers or unsafe casting or undefined behaviour into compiler warnings/errors.
- pjmlp 9y agoWhich is what keeps companies like LDRA in business. http://ldra.com/ http://ldra.com/
- jcelerier 9y ago> This is a little difficult on Windows or POSIX systems. How so ? it's not like you are using the Win32 or POSIX APIs in 2017 anyways
- pjc50 9y agoNot everything has a convenient wrapper, just the high profile stuff like files and GUIs. Are there wrappers for things like dlopen()? posix_madvise? All the various set... functions? Filesystem ACLs? COM objects? (I'm something of an outlier here, maintaining a big legacy MFC application that targets Windows CE, but I can't be the only one. One implication of this is that I'm using the Microsoft MIPS compiler with this banner, that's probably older than some of the readers here and certainly predates C99: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86 Copyright (C) Microsoft Corp 1984-1998. All rights reserved. ... but my point is that it's not sensible to say nobody's using the system native APIs in 2017!)
- jcelerier 9y ago> I'm something of an outlier here, maintaining a big legacy MFC application that targets Windows CE, but I can't be the only one. The problem is not developing "legacy" apps, it's comparing the development and maintenance of "legacy" apps with apps that just get started being written today, for which the bare minimum is being cross-platform. > Are there wrappers for things like dlopen()? posix_madvise? Actually, yes, in a cross-platform way: * http://www.boost.org/doc/libs/1_65_1/doc/html/boost_dll.html http://www.boost.org/doc/libs/1_65_1/doc/html/boost_dll.html (does dlopen, dlclose, and so much more) * http://www.boost.org/doc/libs/1_65_1/doc/html/boost/interprocess/mapped_region.html http://www.boost.org/doc/libs/1_65_1/doc/html/boost/interpro... (advise() == posix_madvise if available) > Filesystem ACLs ? none that I know of :( though MS has a fairly decent "modern C++" API that covers WinRT: https://github.com/Microsoft/cppwinrt https://github.com/Microsoft/cppwinrt but I don't think ACLs are even available in WinRT > COM oh, yes: https://www.codeproject.com/Articles/5748/Introducing-Comet https://www.codeproject.com/Articles/5748/Introducing-Comet
- pjc50 9y agoInteresting stuff. Boost do seem to be aiming for complete wrapper coverage.
- jcelerier 9y ago> Boost do seem to be aiming for complete wrapper coverage. I don't think "boost" is aiming at anything. If you have a good idea of a library (and a good implementation!) you can submit it to boost. It's more a big repository of libraries with a somewhat consistent coding style.