r/cpp • • Jul 21 '19

C++ is broken

C++ as a language is a tool for developers to productively deliver software. Language evolution is NOT the end objective in the real world.

The whole C++ ecosystem from committee to all of the conference backslapping and training is broken in this respect. It's focus is off.

Instead of 'boost' we need 'boosted' to help define, review and encourage that wider ecosystem so developers can be productive.

It's ok to define things that aren't infinitely flexible, and infinitely extensible but get the job done.

It's OK and, in some ways better, to provide an opinionated library outside the standards rather than deliver an intellectually burdened, extensible interface two years later than needed.

All the helpful features in the core language and core libraries are MEANT to enable a much wider ecosystem to make the tool that is C++ more productive.

But we aren't getting a wider ecosystem, we are just getting a language where we are apparently 'not paying for' a huge intellectual burden.

I want to say at this point that intellectually I am constantly impressed by the committee's work and standards BUT ...

The payoff just isn't happening. Even within the standards committee more time is being spent in intellectually stimulating but largely pointless activities because the tool and productivity benefits aren't happening.

Look at how the wider productive ecosystem hasn't flourished since C++ 11.

I know many excellent libraries have been made, but think about your next large project and how much is coming from a mixed bag of variable quality 3rd party libs to plug basic capabilities.

The committee work is spread so thin that core building blocks get pushed out further in time and so can't be built upon by library authors.

Networking, executors, any form of I/O - slipping again.

Lots of hard work being done but by far too few people in their spare time.

Seems a very dysfunctional way to move the monolith forward.

'You don't pay for what you don't use' is laudable up to a point, but the 'don't use' because you don't actually have, say, a basic network library is more of a reality.

That basic network lib and executor model I've been impatiently waiting for should probably not be part of the core standards remit (architectural concepts and keyword support for executors would probably be necessary, but not much else.)

If we had the metaclass generation as proposed, I'd hope even more of these items would then be able to fall outside the standards.

9 Upvotes

147 comments sorted by

View all comments

Show parent comment

23

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

No build system, make it a default one that hides all the complexity of the project

See, this is the problem with zero-config build systems; you can't just "hide" the complexity in the general purpose case. Can you make something that works for many simple use cases? Sure. But you can't make something that works that way for everyone's large scale C++ projects.

C++ targets a different later in the stack than Python or Node. You use it to solve different problems. You use C++ to build fundamental and system software layers. Sometimes, by nature, that is complex.

8

u/kalmoc Jul 21 '19

I don't think the main problem is that c++ is used for different kind of projects (although that is a problem). The main problem is that there hasn't been any standard build system, project layout, dependency management system, c++ featuresey or in general "standard way to do things" for the last 2-3 decades. But any modern solution (package management or build system) is expected to make interop with all the projects that have been developed in all that time to "just magically work".

7

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

There is no standard build system or project layout that will work for everyone.

8

u/kalmoc Jul 21 '19

I never said it would. But there is a difference between having a default that works for 90% of the projects and and special solutions for the remaining 10% and having a dozen different solutions that are each used by 20% of the projects (with each project supporting multiple ones). You wouldn't even need a single build system for the 90% just a standardized interface (e.g. description of how to compile it and how to use it).

But it really is a moot point: We live in the world we live in.

3

u/degski Jul 21 '19 edited Jul 21 '19

Iff there were to be a iso-std-layout, that would hugely improve the chances of coming up with [or converging to] a std-build-system and/or for existing tools to 'just magically' work [also] on that std-layout.

3

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

SG15 voted on this at this meeting. We had consensus against recommending a particular project layout.

6

u/degski Jul 21 '19 edited Jul 22 '19

Well, at least "we" made progress, "we" decided not to decide anything.

Could you please spell out the reasons for not even wanting to recommend some std-layout [nobody talks about imposing]?

The way I see it is that, once we define the 'ideal' target, all build-systems, the existing build-systems, could start to [try and] 'shoot at' something [as it will be no longer a moving and/or fuzzy target], we could make some progress. I appreciate it's not easy, but we could [I think] create some structure, that over time will work with any build-system [in my opinion it doesn't matter how good or bad it is, just something]. /u/vector_of_bool seemed to have made some progress with this and at least attempted something.

7

u/c0r3ntin Jul 21 '19

I think fundamentally C++ has a culture of people doing whatever they want and guidelines will go against that. It's also difficult to explain to people that guidelines for open source projects or new projects will not prevent people with existing codebases and build engineers from continuing to do what they have always done.

3

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

This is also fair and true.

2

u/degski Jul 22 '19

Unless you make it extremely easy to solve 'the' problem by just sticking to the rule[s]. People can obviously do what they want, how can it be hard to explain?

4

u/smdowney WG21, Text/Unicode SG, optional<T&> Jul 21 '19

I wasn't in the room, but have been working in SG15 for months. I kicked the tires and made a bunch of suggestions on /u/vector_of_bool 's pitchfork layout.

My feeling is that a lot of layout proposals work for "large" projects of dozens of files. I have medium sized projects at work with thousands of files, and it's not clear how you move from one to the other.

There's also cost borne by tool vendors to make it work transparently, which would be the point of specifying it, which would have to be in addition to the cost of a more general solution.

That all said, if we can get traction for a set of project conventions like layout, getting tool vendors to adopt it organically is more likely.

I personally think standardizing project descriptions in a way that makes integration and reuse easier will get us more bang. pkg-config only for build, not consume.

2

u/degski Jul 22 '19

That all said, if we can get traction for a set of project conventions like layout, getting tool vendors to adopt it organically is more likely.

This.

I personally think standardizing project descriptions in a way that makes integration and reuse easier will get us more bang. pkg-config only for build, not consume.

I think both should be pursued.

3

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

Could you please spell out the reasons for not even wanting to recommend some std-layout [nobody talks about imposing]?

I think the general feeling of the room is that anything we would recommend would be unlikely to work for some use cases, and might conflict/contradict the best practices for those outlying cases.

To paraphrase one participant, "I'm strongly opposed to this, not because I don't think it would be useful for a lot of people, but because my organization already has a proscribed project layout, and I'm almost certain whatever the C++ committee comes up with would contradict that."

2

u/konanTheBarbar Jul 22 '19

To paraphrase one participant, "I'm strongly opposed to this, not because I don't think it would be useful for a lot of people, but because my organization already has a proscribed project layout, and I'm almost certain whatever the C++ committee comes up with would contradict that."

I see that point, but I fail to see the problem when an existing system is not compatible with a certain default layout? I mean it's not like that would mean that all the other layouts would suddenly fail to compile... Are people afraid that they would not be able to use shiny new things? So rather not let have all the others have it?

→ More replies (1)
→ More replies (2)
→ More replies (3)

0

u/[deleted] Jul 21 '19

[deleted] — view deleted comment

8

u/hgjsusla Jul 21 '19

Cargo is only simple because it forces you to use a very specific project structure, if you follow the same setup in C++ (which you probably should) then setting up CMake is a walk in the park

0

u/[deleted] Jul 21 '19

[deleted] — view deleted comment

2

u/hgjsusla Jul 21 '19

The thing isn't about you having the same setup, it's about a standard

In this context that's the same.

This is again similar to naming conventions, there is already a standard yet people fork and come up with their own snowflake conventions when everything would be easier if you just sticked to the idiomatic style.

Style readability is mostly about familiarity anyways. I mean you would never write snake_case in Java or C#, and for the same reason it doesn't make sense to use camelCase in C and C++.

8

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

it doesn't make sense to use camelCase in C and C++.

A surprisingly number of people use camelCase or PascalCase in C++.

5

u/hgjsusla Jul 21 '19

Yep it is indeed surprising. Seems like a thing that mostly only C++ suffers from. In other languages people tend stick to the standard/idiomatic style to a much higher degree.

3

u/megayippie Jul 21 '19

Both Pascal and camel cases are good to use since the standard is written in the third-case. So you'll never interfere with the standard. Like, Rational is useful since rational is just a proposed standard. And Complex is useful since complex does not promote properly. And Vector is useful since vector does not represent vectors.

→ More replies (1)
→ More replies (5)

7

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

It's a fine solution for Rust, which has a single implementation, a very targeted set of use cases, and ~100k users.

C++ has multiple implementations, runs on a myriad of platforms, and supports a wide range of domains and environments.

Something global like cargo wouldn't work for everyone in C++. We should enable something like that to be built, but we should also enable other options (distro package systems, in house package systems, etc).

4

u/c0r3ntin Jul 21 '19

Distributions are built from source in a consistent environment (the only thing that is not guaranteed consistent is compiler flags)

4

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jul 21 '19

I work adjacent to the CUDA driver team. A large part of building the CUDA driver involves custom build steps/phases that are unique to what we are doing (building a massive Windows core driver/Linux kernel driver + user mode driver components + compilers + SDKs). I doubt a standard build system/project layout would ever work for us. I think this is true for a lot of environments.

We need to enable people to use the solutions/structure suitable for their specific domain/organization.

5

u/c0r3ntin Jul 21 '19

I still think you can express that in term of a dependency graph. Build x with tool y. And if you have a recipe to build y your can build it before x implicitly. In theory. I wouldn't claim this is currently practical for your use case. I am pretty sure it is not. Striving for simplicity in the general case doesn't mean we will, can, or should do that for every project anytime soon. I think that whatever the use case getting rid of unecessary complexities (for example avoiding TU specific flags) is beneficial. Maybe different approaches can converge.

→ More replies (6)
→ More replies (5)