C++

2173 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 2 years ago
MODERATORS
26
27
 
 

Qt 6.10 is now available, with new features and improvements for application developers and device creators!

Highlights for UI builders include a new flex-box layout system for Qt Quick, and support for more vector animations in SVG and Lottie format. And we have listened to your feedback and made it easier to exchange data between C++ code and a Qt Quick UI developed in QML. Such data can then be used with the new SearchField control, or with a new FilledSurface graph from the Qt Graphs module.

If you prefer to maintain your existing codebase, upgrading to Qt 6.10 ensures your application automatically aligns with high-contrast system settings on both desktop and mobile platforms. This and other improvements in our accessibility implementation directly benefits users reliant on assistive technologies, improving usability and inclusivity without requiring any additional development effort.

In addition to these highlights, new APIs across the Qt modules bring increased flexibility and productivity for both QML and C++ developers, and for users of Qt Widgets and Qt Quick.

28
29
30
31
32
33
 
 

I've always found C++'s "trend" of handling normal or non-exceptional system errors with exceptions lackluster (and I'm being charitable). Overall trimming things down to (basically) passing around a couple integers and telling the user to check their manual is much better, much less error prone, and much more efficient and deterministic.

34
 
 

cross post from: https://programming.dev/post/37369902

Hi everyone,

we, the iceoryx community, just released iceoryx2 v0.7, an ultra-low latency inter-process communication framework for Rust, C, C++ and with this release, Python.

If you are into robotics, embedded real-time systems (especially safety-critical), autonomous vehicles or just want to hack around, iceoryx2 is built with you in mind.

Check out our release announcement for more details: https://ekxide.io/blog/iceoryx2-0-7-release

And the link to the project: https://github.com/eclipse-iceoryx/iceoryx2

35
36
37
38
39
40
41
42
43
44
7
C++ with no classes? (pvs-studio.com)
submitted 5 months ago* (last edited 5 months ago) by CodiUnicorn@programming.dev to c/cpp@programming.dev
45
 
 

Hi! ✌️ I need to generate some string in C++ with random characters that can use all letters from "a" to "z" (include capital letters), and all numbers from 0 to 9 there.

And for examples this should looks somehow like this:

SnHXAsOC5XDYLgiKM5ly

Also I want to encrypt that string then by itself:

SnHXAsOC5XDYLgiKM5ly encrypt with SnHXAsOC5XDYLgiKM5ly key.

So, how can I do this in C++? 🤔

Thanks in advance!

46
 
 

So today I wanted to talk about a very cool example that Dan put together on the flight home from Sofia, while I was unconscious a few seats over: the ability to, at compile time, ingest a JSON file and turn it into a C++ object.

47
9
safe enum (programming.dev)
submitted 6 months ago* (last edited 6 months ago) by nodeluna@programming.dev to c/cpp@programming.dev
 
 

for anyone who doesn't know, this "-Werror=switch-enum" compiler option make the compiler throw an error if all of the enum values aren't explicitly handled in a "switch" statement


enum class colors {
        blue,
        red,
        purple,
}

void func(colors c)
{
        switch(c)
        {
                case colors::blue:
                        // do something
                        break;
                case colors::red:
                        // do something
                        break;
                default:
                        // do something
                        break;
        }
}


int main()
{
        func(colors::blue);
}

this code doesn't compile on clang and gcc with the option "-Werror=switch-enum" because the "colors::purple" isn't explicitly handled. be aware that it doesn't throw a compiler error for "if" statements if one of the values isn't handled

48
 
 

It's not fully finished yet, but it's getting there, and i didn't write documentation beyond the README.md and tests/test.cpp but I'd like some feedback on it.

features

  • It's a header only library that's currently < 3000 loc
  • no 3rd-party dependencies
  • support for being imported as a module
  • supports inserting std containers into json nodes
  • highly type safe, which is made possible by using concepts
  • easy-to-use object/array iterations
  • easy-to-use type casting from json value to native c++ types which is enabled by std::variant and concepts
  • exception-free parsing and value casting.
  • modern error handling using "expected" type
  • exception-free node.try_at("key") access
  • and more

edit:

documentation link: https://nodeluna.github.io/ljson

49
 
 
50
view more: ‹ prev next ›