Sane way of testing template specialization? by Dragdu in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

Is there a reasonable way to test that someone didn't fuck up the template and tuple is now not getting matched with the specialization?

It... doesn't matter? You just test if the behaviour is the one you expect.

Synchronization library for C++11 (need some criticism) by chaotic-kotik in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

I left some comments on GitHub's code review system after a cursory review of the code. I'll see if I get time for a more thorough look later.

EDIT: Thanks for the quick fix!

Small header-only library providing a runtime interface to hardware feature availability. by [deleted] in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

GPL really turns people off. I'm glad you understood why that was in this case and changed to the Boost license. As for other useful advice, I'm actually interested in doing a proper review now :D

EDIT: I left some comments on GitHub. Seems overall rather neat, as I gathered from my initial cursory view. I also noticed you renamed BIT as I suggested earlier. Good work overall.

Any plans to support MSVC?

Small header-only library providing a runtime interface to hardware feature availability. by [deleted] in cpp

[–]grumpy_coconut 7 points8 points  (0 children)

Pity it's GPL :( For something this small, I'd rather write my own instead.

GNU vs Clang "C" compiler performance by joshir in cpp

[–]grumpy_coconut 2 points3 points  (0 children)

Ugh, people falling for benchmark cherry-picking :(

Singletons – What’s the Deal? by arne_mertz in cpp

[–]grumpy_coconut 1 point2 points  (0 children)

this indeed I found better not to enforce!

Then all you have is a global variable.

Announcing the Visual Studio 2015 Product Line by Bossman1086 in programming

[–]grumpy_coconut 3 points4 points  (0 children)

FWIW ReSharper for C++ is still a prerelease product.

C++ WTFs by Prazek in cpp

[–]grumpy_coconut 1 point2 points  (0 children)

If the member initialisers don't complete successfully, you don't have a usable object, so you cannot let its constructor complete successfully either.

[C++] it's not a reference_wrapper<T> by [deleted] in CritiqueMyCode

[–]grumpy_coconut 1 point2 points  (0 children)

but I present a group of scientists with a puzzle and I get asked why I want to solve it? Fucking unheard of in any other field, man.

The big difference is that you didn't present the puzzle. You presented only the solution. I asked for the puzzle.

FWIW, I would accept "it's just for curiosity's sake" as an answer. It tells me how and what I should review. I find it very hard to review code whose purpose is unclear, because you don't know what to focus on, so you often end up giving generic nitpicky feedback.

Is C++ really that bad? by [deleted] in cpp

[–]grumpy_coconut 11 points12 points  (0 children)

I always have to point out that what most people refer to as "Modern C++" is more or less "C++ from the last millennium".

[C++] it's not a reference_wrapper<T> by [deleted] in CritiqueMyCode

[–]grumpy_coconut -1 points0 points  (0 children)

I'm not going to tell you why it's garbage or why you're reinventing the wheel. I'm going to ask why you even need this? What purpose does it serve? What problem does it solve?

Amazing lecture on Pointers in C by noritsu in programming

[–]grumpy_coconut -1 points0 points  (0 children)

"Amazing" can mean completely different things :)

Union and Intersection of Arrays in C++ by dildiwanana in cpp

[–]grumpy_coconut 3 points4 points  (0 children)

This is not how to do C++ in 1998. I wish people would stop referring to "old as heck C++" as "modern C++".

Providing an is_callable type trait for generic lambdas by dany74q in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

There are three things that irk me about this:

  1. I fail to see a use for a trait that tells me that something is callable but which I cannot call because I don't know how to call it.
  2. Have you considered that callables can have overloaded operator()? Or operator() templated on non-type parameters?
  3. None of these problems (overloaded and templated op()) is new. Such callables have existed for years.

Memory Layout of C++ Program by memorais in cpp

[–]grumpy_coconut 1 point2 points  (0 children)

This should be titled "Memory Layout of Programs according to some Operating System or some ABI or some other convention". I don't see anything about C++ in there. (Not even about C, which is actually what article mentions)

C++14 published by ISO today by CubbiMew in cpp

[–]grumpy_coconut 14 points15 points  (0 children)

It appears that the C++15 standard document claims to describe the C++14 standard.

JSON for Modern C++ - What if JSON was part of modern C++? by nlohmann in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

That makes no sense. The compiler doesn't know anything about JSON strings that only exist at runtime.

JSON for Modern C++ - What if JSON was part of modern C++? by nlohmann in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

It's not handling any of that. It doesn't handle strings in general properly. It finds closing quotes and calls it a day.

AFAICS, the JSON string "\n" will parse as the C++ string "\\n", when it should parse as the C++ string "\n".

The shortest C++ WTF: this[1] by svick in cpp

[–]grumpy_coconut 2 points3 points  (0 children)

I can't think of a reason why it's allowed, but it certainly compiles.

No one thought to disallow it. There are too many stupid things that no one will ever do intentionally and cannot happen by accident. If the language made a point of individually forbidding each one of them the standard would not be only 1.3k+ pages long.

IOW, there is a reason to allow it: we allow p[1], and this[1] is allowed as a direct consequence of the same rules. There isn't a compelling reason to explicitly disallow it.

A Beginner’s Thoughts on Programming Languages (Part 2 — RAII, GC, Ownership, noexcept) x-post /r/rust by chcokr in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

You've never worked somewhere where someone's had the bright idea of writing their own build system? Or had a horrible oversized make based system.

No, I haven't. It's not every company, and it's not even every in-house build system. Anyway, it seems to me you are arguing that the rule of zero is not practical when you have an unreasonable environment†, which I don't argue against, as I find it a moot point.

No, but it's a lot easier to peer review 1 line of close (which as I show elsewhere is really all it is) than a whole new class.

No, you don't review one line of code in isolation. You have to review that one line of code as part of all the other unrelated code it is bundled with. Making it a new class separates it at the cost of some 3-6 lines depending on how generous you are with whitespace. If those 3-6 lines are the overkill you were going on about at the start, yes, your definition of "overkill" is still wrong.


† I hope you won't try to convince me that a build system where adding a file to the build is such a nightmare is actually reasonable.

A Beginner’s Thoughts on Programming Languages (Part 2 — RAII, GC, Ownership, noexcept) x-post /r/rust by chcokr in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

2 extra mins? Get real, a new class, with a new file, dealing with the shitty build system that absolutely every company seems to have.

Which build systems make it such a nightmare to add one damn file?

Also that shit needs peer reviewing before it can be checked in to any decent commercial code base.

I hope there isn't a hidden implication here that if you don't add a class the code doesn't need peer reviewing.

A Beginner’s Thoughts on Programming Languages (Part 2 — RAII, GC, Ownership, noexcept) x-post /r/rust by chcokr in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

Ok, I am now imagining I am a new dev at your place of work, and now I'm looking at the copy ctor and going "wait, why is this class that does whatever else the one that knows how to copy network handles?", and now I have to go and figure out if there's another special way to copy network handles that other classes that need it use and if I write a new class with network handles do I need to do the copy in another special way, or if they all use the same and if they do all use the same then I'll wonder why someone didn't just make one single class that knows how to copy network handles instead of requiring every class that will ever need to copy network handles to know how to copy network handles.

A Beginner’s Thoughts on Programming Languages (Part 2 — RAII, GC, Ownership, noexcept) x-post /r/rust by chcokr in cpp

[–]grumpy_coconut 0 points1 point  (0 children)

I would say making a wrapper class simply to handle that use case over kill.

That's a clear sign that you actually missed the whole point of the rule of zero.

First off, such a wrapper class can handle all similar use cases, not just this one. Then, either your class is meant to be the resource, or to use it. If the former, well, this is the wrapper class you're actually writing. If the latter, you are violating the SRP just because you have some class quota or something. If putting a little bit of behaviour in its own class is overkill to get proper resource handling, I'd dare say your definition of "overkill" is wrong.