Please explain how to package everything needed to compile and run an executable
C Board » C++ Programming
by Hb3
2w ago
I can't seem to find anywhere online that explains it to me in stupid enough terms for me to accomplish this. How do I make sure all the necessary files are there when I run an executable after compilation? For this specific program, it's a simple linked list I'm trying to learn to build using a modular strategy. But people have portable programs that are much more complex than the grade school program I've created. So, I'm trying to figure out how to have the necessary files to run the executable like a portable program, but I'm not really sure how that is supposed to be accomplished. Is i ..read more
Visit website
Pointers to pointers and reinterpret cast
C Board » C++ Programming
by shrink_tubing
2w ago
Hi there, There's one place in my project where I have to use the reinterpret cast. The compiler will not allow me to use anything else. I imagine if I just have a pointer it's a pointer to a specific variable type. Whereas if I have a pointer to a pointer it's only ever a pointer to a memory address. I read recently that reinterpret cast can make code non-portable. I'm not even too sure what that means, however I'm guessing that is only a problem with a pointer to a variable type rather than a memory address. I would assume any system would take its own default size of memory address and j ..read more
Visit website
Help understanding code
C Board » C++ Programming
by Ducky
1M ago
I found this code on the internet and I don't understand whats the point of this line : (str[i] - '0') I know its not working without it but whats the point of subtracting 0 of something? Code: #include <string> #include <iostream> using namespace std; int string2sec(const std::string& str) {     int i = 0;     int res = -1;     int tmp = 0;     int state = 0;     while(str[i] != '\0')     {         // If we got a digit         if(str[i] >= '0' && str[i] <= '9 ..read more
Visit website
How and where is int_bottom invoked?
C Board » C++ Programming
by john_12
1M ago
Hello, I am following along a tutorial on operating systems and do not understand where in the code the "int_bottom" routine is invoked (it is written in interrupstubs.s). Can someone tell me how/where it is invoked? Thanks! this is the tutorial, the code is written first in commit number 5: Files for part 5, https://www.youtube.com/watch?v=AgeX-U4dKSs * AlgorithMan-de/wyoos@01557ac * GitHub you can go to commit number 5 by cloning this repository and executing git checkout 01557ac3b68bc7f9e39e76d4b4bf2fdbe627ce3d to reset to commit number 5 ..read more
Visit website
A really stupid question about struct constructors
C Board » C++ Programming
by shrink_tubing
1M ago
Hi there, Idk why but this has got me worried. I've had to make a change to a function written by someone else as it won't compile in conformance mode. It was throwing the good old C2102 error :rolleyes: Code: CD3DX12_HEAP_PROPERTIES heapProperties(D3D12_HEAP_TYPE_DEFAULT); ThrowIfFailed(md3dDevice->CreateCommittedResource(     //&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), - will not compile in conformance mode 20/3/24     &heapProperties,     D3D12_HEAP_FLAG_NONE,     &depthStencilDesc,     D3D12_RESOURCE_STATE_COMMON ..read more
Visit website
Question about strange constructors in class
C Board » C++ Programming
by shrink_tubing
1M ago
Hi there! Have a look at the following code in a class: Code: class D3DApp { protected: D3DApp(HINSTANCE hInstance); D3DApp(const D3DApp& rhs) = delete; D3DApp& operator=(const D3DApp& rhs) = delete; virtual ~D3DApp(); ....omitted The parts in bold have confused me. I see a constructor which takes a HINSTANCE and a destructor that can be over-ridden. But what are the other two lines in between those? I really haven't got a clue! Thanks ..read more
Visit website
What's the difference between a process and a thread?
C Board » C++ Programming
by shrink_tubing
1M ago
Hi there, I thought it's about time I learned this one. I've been doing some research of my own but I thought I'd ask on here as well, as I've had some great advice on here before. I've been learning about DLL's and seems there's a lot more to it than just using the standard Load and Free library functions. I always thought a thread was something handled exclusively by one processor. And a process was something contained within that thread. I don't really know to be honest though, so thought best to ask :) Thanks ..read more
Visit website
Memory leaks, and hung up API stuff when using new keyword to make a class
C Board » C++ Programming
by shrink_tubing
2M ago
Hi there, Having just recently fixed an issue with memory leaks and DirectX objects still being live after shutdown I was wondering if it's a bad idea to create a class using the 'new' keyword if it contains smart pointers? I was using 'new' to make a class that does some basic rendering stuff that worked quite nicely until it came time to close the window and thus the program. The debugger was showing all kinds of issues as mentioned above. I made sure I had a 'delete this' line in the class destructor too. Some of the problems experienced were multiple class destructor calls, seemingly in ..read more
Visit website
Empty Vector tricky problem after Windows Update
C Board » C++ Programming
by shrink_tubing
2M ago
Hi there, I'm not sure if this belongs here or in the Gaming forum. I'll post it here as I guess a lot of the problem is C++ related. Please move it elsewhere if this is the wrong place thankyou. Well...to begin with, when I fired up my old program I've used so many times before it suddenly ended with a bad looking error. Then when I ran debug I ended up all the way into here: Pretty scary. Turns out a vector wasn't initialised properly. By now I'm obviously becoming worried that I will never fathom code no matter what and all sorts of thoughts are running through my mind. This is much ..read more
Visit website
How can a class or struct contain a copy of its own type?
C Board » C++ Programming
by shrink_tubing
3M ago
Hi there, I was perusing through some code and I found this: Code: struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER {     CD3DX12_RESOURCE_BARRIER()     {}     explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) :         D3D12_RESOURCE_BARRIER(o)     {}     static inline CD3DX12_RESOURCE_BARRIER Transition(         _In_ ID3D12Resource* pResource,         D3D12_RESOURCE_STATES stateBefore,         D3D12_RESOURCE_STATES stateAfte ..read more
Visit website

Follow C Board » C++ Programming on FeedSpot

Continue with Google
Continue with Apple
OR