« first day (1573 days earlier)      last day (1271 days later) » 

3:15 AM
I'll get into it as soon as I'm done with something else
for now I'm having an annoying problem with the "Rectangle" word. I'm trying to define a rectangle structure, but the compiler understands it as a function: BOOL __stdcall Rectangle(HDC hdc, int left, int top, int right, int bottom). Is there a way to get rid of this?
I'm not even using this function anywhere
 
 
4 hours later…
6:49 AM
I just read something about ABI and binary compatiable.
For example, assume I am using Windows, and I made a a.dll library and a main.exe executable (main.exe uses code in a.dll), all compiled with Compiler A. One day, I saw a new compiler Compiler B under Windows and I decided to recompile a.dll with the same original source code. Then I replace the previous a.dll with this new one.
So according to what I just read aobut ABI and binary compatiable, things may probably get wrong?
 
 
4 hours later…
11:17 AM
@Rick yep, things might break. If you're just using your own types it should be mostly fine, but if you're passing/returning standard library types like std::string and std::vector then things could break
but for Windows they started backward compatibility since Visual Studio 2015, so VS 2015-2019 should be compatible mostly
 
 
5 hours later…
4:11 PM
elipsis is an operator or an punctuator?
about calling convention, what happends when you pass "..." variable number of parameters to a function ? How is the callee able to restore the stack pointer where it should? And how can the caller clean up the stack after the call ?
 
@CătălinaSîrbu it's different between C-style VA-args and C++ variadic templates
 
but the principle
so the problem is that there are some calling conventions with are different one to other
for e.g cdecl vs stdcall
I don't understand how can you clean as a calle the stack if you receive var args vs how can you do the same thing but from the point of view of caller
 
The c++ variadic templates work more like the normal calling convention ,because you have all the information at compile-time
and you create overloads for each instantiated number of arguments
 
and which is responsible for what? (callee and caller )
what calling convention is used
 
 
6 hours later…
10:33 PM
if I allocate dynamic memory inside a function (int* function) and return that to caller, how can you delete that address after you've exited the function? Doesn't the function delets the allocated memory?
 
if you allocate with malloc or new, it will not get automatically deleted just by control-flow
you will need to call free/delete for it to be deleted
 
10:47 PM
and then what is forbidden to return ?
or can be undefined behaviour
return a automatic variable ?
 
yeah, if you return a pointer or reference to a local variable with automatic storage duration, that is undefined behavior
 

« first day (1573 days earlier)      last day (1271 days later) »