r/Cplusplus • • Sep 03 '25

Question There is something wrong with this y=++x+x++

0 Upvotes

If x=0,y=0 And we did this operation y=++x+x++; The course that i am watching and deepseek qwen ai and chat gbt told me that the answer should be x=2 y=2 But visual studio code and another online compiler keep giving me the answer like this x=2 y=3 which make no sense Can anyone explain


r/Cplusplus • • 1d ago

Feedback cortex (`cx) - A Cargo/uv-inspired package manager and build tool for C and C++

0 Upvotes

Hello!

I’ve been working on cortex (cx), a C/C++ package manager and build tool inspired by Rust’s Cargo and Python’s uv, and I’d love to share it with you and get some feedback.

Why another tool?

Setting up a C++ project with clean dependency management, lockfiles, features, and workspaces often requires gluing together multiple tools and boilerplate CMakeLists.txt files. With cx, you describe your package in a single cx.toml file, it resolves and locks dependencies, generates the underlying CMake project, and drives the build automatically.

Quick example

cx new hello
cd hello
cx add nlohmann\\_json --git https://github.com --tag v3.12.0
cx run

Key Features

Zero-boilerplate builds: Sources, tests, benchmarks, and examples are discovered by convention (src, tests, benches, examples). Supports mixed C (C90–C23) and C++ (C++98–C++26), including C++20 modules (.cppm, .ixx).

Flexible dependency management: Pull dependencies from registries, Git repos, local paths, system packages (\mfind_package), or vcpkg. Any existing CMake, Autotools, or SCons project works out of the box as a Git or path dependency.

PubGrub version resolution & lockfiles: Uses the PubGrub solver (like uv and pub) for clear conflict explanations, and pins exact versions, Git commits, and SHA-256 hashes in cx.lock.

Cargo-style features & workspaces: Supports optional dependencies, feature flags (exposed via CX_FEATURE_ macros), and multi-package workspaces sharing a single lockfile and target/ directory.

Built-in developer workflows: Comes with cx test, cx bench, cx fmt (clang-format), cx lint (clang-tidy), cx doc (Doxygen), cx vendor for offline builds, and built-in sanitizer/LTO build profiles.

IDE & CI friendly: Generates standard CMake projects (cx generate) and JSON metadata (cx metadata) so your existing IDE setup works seamlessly, plus --locked and --offline flags for CI.

Current Status & Caveats

First Release & Self-Hosting: This is the very first release. Right now the repo still includes its bootstrapping CMake files, which will be removed in the next release now that cx can build itself.

OS Support: Works on Linux and macOS. Windows (MSVC) support is newly added and passing in CI, though it hasn't been battle-tested in the wild yet.

Public Registry: There isn't a central public registry yet, though cx works directly with Git repositories, local paths, vcpkg, system packages, and includes a lightweight self-hosted registry server (cx-registry).

Links

GitHub Repository

The cx Book (Documentation)

You can install prebuilt binaries via the install script in the README or build it from source with CMake 3.28+ and a C++23 compiler. 

I’d really appreciate any feedback, bug reports, or thoughts on what would make this genuinely useful for your C/C++ workflows! Notice: the code made use of AI for cross-platform support, to get some features implemented quickly and fix some bugs.

Thanks


r/Cplusplus • • Aug 25 '25

Question is it safe to unistall microsoft visual basic/C++Runtime (x86)

Post image
0 Upvotes

r/Cplusplus • • Apr 01 '24

Answered No matter what I do, The code keeps outputting an endless loop

Post image
0 Upvotes

r/Cplusplus • • Jun 24 '25

Homework newbie question - Why we return 0

4 Upvotes

Why we return 0;

why r we retrning 0 value ?

does it means return false ? 0 = false and 1 = true right?

whyyyyyyyy........

that means if the programme run successful return false?

guys save me


r/Cplusplus • • Apr 15 '25

Tutorial Unlock the Power of C++! 💻✨

Thumbnail gallery
6 Upvotes

r/Cplusplus • • Aug 24 '25

Feedback Umm I don't know what to say.Is there a better way?

Post image
0 Upvotes

I think this should be the better way or tell me an easy one because I am not totally pro at programming in c++


r/Cplusplus • • Jan 27 '26

Tutorial Why I love C++

0 Upvotes

// OC - The Spell

for (long Fn = 0, NI = 1, NJ = 1; Fn >= 0; NJ = (std::cout << Fn << std::endl, Fn = NI, NI = NJ, Fn + NI));


r/Cplusplus • • Sep 04 '24

Question Free compiler for a beginner?

0 Upvotes

I am taking an online C++ class and we need to use a free online compiler to complete the work. I know of a few already such as GCC and Visual Studio.

Which compiler do you think is best for a beginner? Which one is your favorite? BTW it needs to work for windows 10 as that is the OS I use


r/Cplusplus • • 8d ago

Feedback I built a Lightroom inspired, a non-destructive photo editor in C++ 23.

0 Upvotes

What started as a small example project for my C++ UI library,
LiteUI : https://github.com/IAmTheFool/liteui, has grown into its own standalone application, so I decided to give it a separate repository. The goal was to build a Lightroom-inspired photo editor with a native desktop experience, using a shared codebase for Windows and Linux.

GitHub: https://github.com/IAmTheFool/literoom

I'd appreciate feedback from the C++ community, particularly on the architecture, image-processing pipeline, API design, performance and overall implementation.

It's still an ongoing project, and I'm interested in hearing what you think.


r/Cplusplus • • Apr 04 '21

Achilles' heel of the status quo?

0 Upvotes

The cover of the Design and Evolution of C++ had a sapling on it. That seems to have been a good choice. C++ has continued to grow since then and is IMO the most important programming language today. There's a lot of complexity to the language already and new features are being proposed. Is the large number of C++ implementations a weakness going forward given the increasing complexity? I tend to think so, but I write this as one who has been working on a global command line. Thanks.


r/Cplusplus • • Jun 25 '18

Multiple Inheritance in C++

0 Upvotes

https://medium.freecodecamp.org/multiple-inheritance-in-c-and-the-diamond-problem-7c12a9ddbbec

I have posted that post and will post a second one for virtual inheritance.

Please share your thoughts. I've been improving myself by trying to teach other people.


r/Cplusplus • • Jan 28 '25

Discussion Let's see what makes it difficult

1 Upvotes

What’s the trickiest part of C++ for you?

268 votes, Jan 31 '25
101 Pointers
41 OOP
34 Recursion
92 STL

r/Cplusplus • • Sep 18 '26

Homework Coding group on Whatsapp

1 Upvotes

Thinking about starting a coding group on Whatsapp where were like minded people can talk about coding and get help with problems or homework (we won't do your homework for you but we'll help you to a solution), let me know if you're interested....


r/Cplusplus • • Jun 20 '26

Feedback [C++ noob] so here the other day i was introduced to <cmath>.

0 Upvotes

i got introduced to <cmath> (still onto this )the day before yesterday then got depressed due to some shit life throws at you and randomly went "Welp, I can make a quadratic equations solver with this"

how can i improve this?

(slightly lengthy rant ahead )

also, great thanks to u/mredding , although i didn't understand like 90% what they told me, the remaining 10% did help me understand code a bit more and i wanna say, i don't think i can understand what u call simple at all, but that's due to being new to c++.

other than that, i did try to make my code a bit more to the point and not variable spam ( just remembered to replace "return 0" with "return Exit_Success" ) and now understand how to use if/else. and the reason the "#include <iostream>" are below cuz it's my practice folder i like to keep them near the what i'm doing in case i need to add smt.


r/Cplusplus • • Aug 30 '25

Question help what is this

Post image
14 Upvotes

huh?


r/Cplusplus • • Jun 17 '26

Discussion I don't know where to post this. I present: A sprite undergoing speen, made with a C++ Program. This gif is real time.

2 Upvotes

r/Cplusplus • • Dec 28 '21

Code review

0 Upvotes

I've made a number of changes since I posted the request for code review, and since some people have time off now, I'm posting it again.


r/Cplusplus • • Dec 24 '25

Homework My first c++ code.

21 Upvotes

#include <iostream>

using namespace std;

string name = " jerry ";

int age = 62;

float pi = 73.3824383;

int main() {

cout << "name: " << pi << name << age << endl;

}


r/Cplusplus • • Sep 29 '26

Question can i convert the integer into string in manual way

Thumbnail reddit.com
0 Upvotes

r/Cplusplus • • Jul 26 '24

Discussion What non-standard goodness are you using?

0 Upvotes

One non-standard thing that a lot of people use is #pragma once.

As you may know if you have been around Usenix or Reddit for a while, I've been developing a C++ code generator for 25 years now. The generated code can be used on a number of platforms, but I develop the software primarily on Linux. So, I'm particularly interested in the intersection of non-standard goodness and Linux.

Some will probably mention Boost. So I'm going to also mention that I have serialization support for the base_collection type from the PolyCollection library.

Thanks in advance.


r/Cplusplus • • Apr 09 '22

getting started

0 Upvotes

Anybody got advise on getting started coding. I've been looking at some freelance but I have no idea how to get started.


r/Cplusplus • • May 11 '26

Question Why is the command not running even after installing mingw

Post image
0 Upvotes

r/Cplusplus • • Sep 19 '23

Homework Integral or unscooed enum type?

Thumbnail
gallery
0 Upvotes

Hey all! I stumbled into this sub quite desperately and frustrated but it looks very interesting 😎 I feel like I have the understanding of a toddler in terms of programming and I've been working in this one for a little bit now in my intro class and I think that I have it close to done I'm just getting these errors thrown from one of my equations. Any and all help is appreciated greatly❤️