Old 08-25-2017, 05:41 AM   #1
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,248
Default C++17

Just about to start coding the Control Surface Integrator, anyone know of a reason(s) why I should use/not use C++17 compilers for the project ?
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is offline   Reply With Quote
Old 08-25-2017, 06:37 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Reasons why you might not want to use it (or even C++11 compatible compilers) :

1) If you need to support ancient macOS-X versions. macOS-X 10.7 is the first one to have support for C++11. (More precisely, support for the C++11 standard library.) Newer C++ standards might require even later macOS versions.
2) If you need to support Windows XP. I have never got the so called "Windows XP compatibility" working with the newer Visual Studio versions. (Like VS2015 or VS2017.) The resulting binaries simply have not worked on XP for me or for people who have tried to test the binaries. It might work if the end user Windows XP installation is completely up to date with SP3 and all possible updates. I never bothered testing that scenario myself.
3) The Microsoft C++ compiler and standard library and Apple's compiler/library are not at the same level of standard compliance. If you write code that compiles for macOs, it might not work with the Microsoft compiler and vice versa. So you need to be careful which language and standard library features you use. Both platforms have good, but not complete, C++11/14 coverage now, though.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 08-25-2017 at 06:44 AM.
Xenakios is offline   Reply With Quote
Old 08-26-2017, 12:10 PM   #3
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,248
Default

As usual, good points, thanks Xen.
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is offline   Reply With Quote
Old 08-26-2017, 04:54 PM   #4
Garrick
Human being with feelings
 
Garrick's Avatar
 
Join Date: Jul 2009
Location: Wellington
Posts: 4,622
Default

Do any of you guys use "auto" for your types?

It feels wrong to me somehow
Garrick is offline   Reply With Quote
Old 08-26-2017, 05:05 PM   #5
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,248
Default

Quote:
Originally Posted by Garrick View Post
Do any of you guys use "auto" for your types?

It feels wrong to me somehow
I grew up on a curious mix, assembly, C, and Smalltalk.

So, hell yeah, I'll be using auto wherever I can
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is offline   Reply With Quote
Old 08-26-2017, 05:22 PM   #6
Garrick
Human being with feelings
 
Garrick's Avatar
 
Join Date: Jul 2009
Location: Wellington
Posts: 4,622
Default

Quote:
Originally Posted by Geoff Waddington View Post
I grew up on a curious mix, assembly, C, and Smalltalk.

So, hell yeah, I'll be using auto wherever I can
Assembly infers type? Is there no end to this madness.
Well that shows how much I know. I thought assembly would be super dupa strict and make you be explicit about everything.

Last edited by Garrick; 08-26-2017 at 05:27 PM.
Garrick is offline   Reply With Quote
Old 08-26-2017, 06:17 PM   #7
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Garrick View Post
Do any of you guys use "auto" for your types?

It feels wrong to me somehow
It's highly debatable if "auto" is that useful for trivial stuff like integer or floating point types, but it's clearly useful when more complicated types are involved. For example, do you want to write

Code:
std::unique_ptr<MyFancyObject<String>> o = std::make_unique<MyFancyObject<String>>("foo");
or would you prefer

Code:
auto o = std::make_unique<MyFancyObject<String>>("foo");
?

And yeah, I do use "auto" regularly.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 08-26-2017 at 06:44 PM.
Xenakios is offline   Reply With Quote
Old 08-26-2017, 10:05 PM   #8
Garrick
Human being with feelings
 
Garrick's Avatar
 
Join Date: Jul 2009
Location: Wellington
Posts: 4,622
Default

Quote:
Originally Posted by Xenakios View Post
It's highly debatable if "auto" is that useful for trivial stuff like integer or floating point types, but it's clearly useful when more complicated types are involved. For example, do you want to write

Code:
std::unique_ptr<MyFancyObject<String>> o = std::make_unique<MyFancyObject<String>>("foo");
or would you prefer

Code:
auto o = std::make_unique<MyFancyObject<String>>("foo");
?

And yeah, I do use "auto" regularly.
Whoa !!
Yeah I can see now how auto could be a godsend.

Especially in your example where your fancy object's name will pretty much document itself and so easier to reason about.

This is good, it's making me re-think the whole thing.

Like you say, it has limited usefulness with primitives, but if you did, how do you cast from one type to another if you're not explicit what type it originally was?
Garrick is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.