🍌 C++ Feed
306 subscribers
218 photos
12.7K links
Агрегатор всего подряд про C++.

Для связи: @smertig

Powered by https://github.com/Smertig/banana
Download Telegram
C++ – Типизированный язык программирования
[Перевод] Тридцать лет С++. Интервью с Бьерном Страуструпом



Ранее мы делали материал про использование C и C++ в Data Science. А сегодня мы хотим поделиться с вами интервью с автором C++ Бьерном Страуструпом. Далее в посте вас ждет рассказ о профессиональном пути Бьерна, деталях создания собственного языка программирования и извлеченные им из этого уроки.
Приятного чтения!
CppCon (Youtube)
A New Decade of Visual Studio: C++20, Open STL, and More - Marian Luparu & Sy Brand - CppCon 2020

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
As C++20 brings new features for C++ programmers at all levels of experience, so does our last year of work on Visual Studio and MSVC. New versions of the IDE have brought new productivity features and experience improvements for all developers, no matter what platforms they are targeting. Our open source standard library has seen contributions from across the C++ ecosystem, improving in conformance and performance. We've been hard at work on key C++20 compiler features like Concepts. We're also working on bold new ways of working on C++ projects with cloud environments.

Come along to hear about all of these as well as announcements about the future of our tools.

---
Marian Luparu
Microsoft
Princi...

Read full post
CppCon (Youtube)
Some Things C++ Does Right - Patrice Roy - CppCon 2020

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
People often complain about C++: to some, it's not memory-safe enough, not type-safe enough. Some will tell you that some (or all!) of its defaults are wrong. Many complain that it's too expert-friendly.

There's often a grain of truth in criticism, and C++ surely has a bit of each of these alleged warts; it's a language that has history, obviously, and that has evolved organically over the years, and it has the imperfections we can expect for a tool used by millions to perform high-performance or safety- critical tasks in various application domains.

However, there are a significant number of things C++ does right, and there are a number of reasons why we love this language... and love it so much that we gather together to trade ideas, lea...

Read full post
Standard C++ (Twitter)

Broader coverage of C++ Core Guidelines & broken access control detection with SonarQube and SonarCl bit.ly/3jKi6DJ #cpp
Standard C++ (Twitter)

Range-v3: An Introduction to the Library [In Spanish] -- Daniel G Vergel bit.ly/3iIvy9V #cpp
C++
“C++ Primer” seem a bit aggressive?

So I only come from the slightest of coding background as I tried to learn python last year. Didn’t do too badly conceptually, but not having a job for it or really knowing what it could do, I fell out of interest. The reason I mention this is I have learned loops, if; else; elif, etc. Well recently I had an itch to learn c++ as it’s og but not too og. After some research I found many, Many people admiring “C++ primer”. I must say I am very disheartened for the rest of the book at chapter 1. In about 6 pages, it has discussed input/output, for loops, while loops, if/else.... without once explaining the nature of the function itself. Udemy courses and Python books I read spent whole chapters on loops, how they are iterated, best purposes for each type... I want to learn cpp because it gets much closer to the machine, which greatly excites me, but I’m worried the resource I’ve found in C++ Primer is not one that will truly teach me why I’m doing things. Am I completely wrong? submitted by /u/Rich_Foamy_Flan
[link] [comments]
Fluent C++
Adapting STL Algorithms on Sets

This article is NWH, standing for Not Written Here. NWH is inspired from the NIH (Not Invented Here) syndrome which consists in refraining from using existing code from outside the company and reinventing the wheel every time. Just like it is good practice to look out for solutions developed elsewhere, we’re going to look at […]
The post Adapting STL Algorithms on Sets appeared first on Fluent C++.
C++
Join me for a ride! [Paid Oppertunity]

Hello Reddit, it's my girlfriends 1 year soon and I was thinking about different gift ideas. Until I came up with this brilliant idea that I think she would enjoy but it does require some knowledge that I would need help with. We are going to do long distances and I would like to create a website that displays a 24-hour timer and every time it hits 24 hours it displays a new message. I would also to get this done in c++ because that is the language I am learning. I know I currently would not be able to do this at all and would need someone to help me out. I am willing to pay if someone could help me with this project whilst explaining to me whats going on. If you think you could do this please let me know and shoot me a message. Thank you in advance and have a good day. submitted by /u/MrMinimize
[link] [comments]
CppCon (Youtube)
How C++20 Changes the Way We Write Code - Timur Doumler - CppCon 2020

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
The upcoming C++20 standard is the biggest update in a decade. Its feature set and their impact on how we write C++ will be as large, and possibly larger than that of C++11.

In this talk we will look at how new features like concepts, coroutines, and modules will fundamentally change the way we design libraries, the way we think about functions, and even the way we compile our code. We will also mention some long-standing warts in C++ which are finally cured.

---
Timur Doumler is a C++ developer specialising in audio and music technology, an active member of the ISO C++ committee, and Conference Chair of the Audio Developer Conference (ADC). He is passionate about building communities, clean code, good tools, and the evoluti...

Read full post
Arthur O’Dwyer
Inheritance is for sharing an interface (and so is overloading)

This blog post was inspired by my answer to a question
on Code Review StackExchange. To utterly oversimplify the question: When is it appropriate
to use classical inheritance?

struct Cat {
void meow();
};
struct Dog {
void bark();
};

// Should I write a struct AbstractAnimal?


Here’s what the same code would look like, with an AbstractAnimal base class
(and omitting the NVI
for pedagogical reasons):

struct AbstractAnimal {
virtual void do_speak() = 0;
};

struct Cat : public AbstractAnimal {
void meow();
private:
void do_speak() override { meow(); }
};

struct Dog : public AbstractAnimal {
void bark();
private:
void do_speak() override { bark(); }
};


The only reason to use a base class here is in order to write polymorphic code that operates
on (a pointer or reference to) that base class.

// If all my code looks like this, I don't need a base class.
void operateOnCat(Cat *c) { c->meow(); }
operateOnCat(myCat);

// I need the base class only if I want to write code like this.
void operateOnAnything(AbstractAnimal *a) { a->do_speak(); }
operateOnAnything(myCat);
operateOnAnything(myDog);




If you don’t need to write operateOnAnything, then you shouldn’t write AbstractAnimal.
Abstraction is a tool for solving problems — and, as such, it is also a signal to the reader
that a problem is being solved! If your code doesn’t actually need polymorphism in order
to work, then you should avoid making an inheritance hierarchy.


Keep it simple, stupid.


The design principles of polymorphic programming apply equally to generic programming…

When should I name two methods the same?

Notice that in our original Cat/Dog code, I named the two methods Cat::meow()
and Dog::bark(). It’s very tempting to give them the same name:

struct Cat {
void talk(); // meows
};
struct Dog {
void talk(); // barks
};


However, this is once again a signal to the reader that something indispensable is
going on here! Meowing and barking are vaguely similar at an abstract level, yes;
but abstraction is a tool for solving problems, and so we should avoid it unless
a problem exists to be solved.

The only reason to use the same name for meowing and barking, here, is in order
to write generic code that operates on an object of unknown type T.

// If all my code looks like this, I don't need to reuse the
// same name in both classes.
void operateOnCat(Cat& c) { c.meow(); }
operateOnCat(myCat);

// I need the same name only if I want to write code like this.
template
void operateOnAnything(T& t) { t.talk(); }
operateOnAnything(myCat);
operateOnAnything(myDog);


Notice that another way to ask “When should I name two methods the same?”
is to ask “When should I define a C++20 concept modeled by both these classes?”
The rules of classical OOP are isomorphic to the rules of generic programming with
concepts: just replace “base class” with “concept” and “derives from” with “models.”

Let’s go deeper.

When should I put two functions into an overload set?

The previous section was about reusing the same name outside of an overload set:
Cat::talk and Dog::talk aren’t “overloads” per se. But what about something like
this?

struct Snake {
void eatPellet(const Pellet&);
void eatCat(const Cat&);
};


Should we rename both methods to just Snake::eat, creating an overload set?

The only reason to use the sa
C++
periodic_function v0.1.0 released! Thank you all for the helpful feedback!

A while back I made my initial post about the periodic_function library I had created and I receive a ton of feedback. Thank you so much to everyone who commented. Your suggestions and critical eyes have made the library more robust and better overall. The suggestions and comments have been addressed in the v0.1.0 release and I hope some of you can find it useful. Thank you again! I really appreciate those who took the time to nitpick my code; it was eye-opening and a great learning experience. Release is here. submitted by /u/mrkent27
[link] [comments]