Anonymous
klimi
rather go invest in forex bitcoin
klimi
what ads? :D
labyrinth
Hi guys, I have a question; it is well known that for polymorphism, we use virtual destructor to avoid memory leak. Typical example without the virtual keyword for destructor shows that if a member of parent class is a pointer, then the memory on heap cannot be freed. However, how about a typical int member of the parent class. Without calling the parent destructor (consequence of not having virutal destructor for polymorphism), will a typical stack variable be freed?
Alex
labyrinth
it is true that no code need to take care of the stack memory management, but the thing is, the end of a class is typically marked as the call of destructor, but without even calling it as a bug under polymorphism, does it really end?
labyrinth
the end of a class instance
labyrinth
i mean, will it happen to be only destructing the child part instead of parent part, if the destructor is not virtual
Vlad
Vlad
If you don't have virtual destructor
Anonymous
Nils
Is using the result of an assignment expression allowed?
V01D
Anonymous
Pls is there any group for web development
V01D
Hassen
Hello
klimi
Hassen
Hassen
I'm new here , I need help
Hassen
I would like to get cppbook guide book
Nils
fread(this_kb->event_buf, sizeof(*this_kb->event_buf), 1, this_kb->kbdev);
Any idea why this causes a segfault from time to time?
Vlad
Vlad
It may not be not even this line :P
Nils
Just had to hit the compile button again :P
Nils
Vlad
Linker got mad on ya :P?
Mr Xyz
Is this computer knowledge related group.
Anonymous
UB??🧐
Anonymous
ohh!!
Amj
Anunay
Dima
MᏫᎻᎯᎷᎷᎬᎠ
Like what cases exactly, other than the memory is full?
MᏫᎻᎯᎷᎷᎬᎠ
I've read that the OS do some virtualization processes in case if the memory is full like using the HDD for swapping the unused partitions of your program for later use, which frees some space in the RAM
MᏫᎻᎯᎷᎷᎬᎠ
I think that is how every 30+gb games or heavy softwares are handled
MᏫᎻᎯᎷᎷᎬᎠ
Yes it's outside of the scope, but has an affects for C++ runtime whether to throw std::bad_alloc or not
MᏫᎻᎯᎷᎷᎬᎠ
Patterns like what?
MᏫᎻᎯᎷᎷᎬᎠ
Okay
Thanks
MᏫᎻᎯᎷᎷᎬᎠ
/report
OZAIR
/get cbook
OZAIR
/get cbookguide
OZAIR
/get cppbookguide
V01D
Amj
Lol, why
It was hit while scrolling 😬
V01D
Sandro
hello, someone can explain how to "compare" function is called without brackets and args?
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int compare( const void *arg1, const void *arg2 );
int main( int argc, char argv ) {
int i;
argv++;
argc--;
qsort((void *)argv, (size_t)argc, sizeof(char *), compare);
for( i = 0; i < argc; ++i )
printf( " %s", argv[i] );
printf( "\n" );
}
int compare( const void *arg1, const void *arg2 ) {
return strcmp( * ( char ) arg1, * ( char** ) arg2 );
}
Sandro
I know is a pointer to a routine in function qsort, but how function qsort can call compare function?
Sandro
I mean the code in qsort to call compare function, thanks
Alex
void func(void (*func_ptr)(int))
{
func_ptr(5); //this is your call
}
Sandro
Murat
hello, I'm doing a program. In this program, c# applications are called.
Murat
https://www.codeproject.com/Articles/1236146/Protecting-NET-plus-Application-By-Cplusplus-Unman
Murat
I'm editing this. The program is correct yet I need to detect and prevent memory leaks.
Murat
I don't want the C# application to be accessed via memory. Can you help me?
Renan
Gul
Anonymous
What will be the logic for digit to word conversion in C++ ?
Anonymous
V01D
Perhaps you can load and read a json file.
Like maybe you have one json from 0 -> 10, and another from 10 -> 100, then 100 -> 1000, etc.
V01D
Or you take a look at nlp, I think that could help. Idk though
J
because that's not a VLA, nor is the warning related.
Vlad
Vlad
Btw flag for it is -Wvla
J
either way - that wasn't even the error he faced. it was not using the array anywhere
J
okay, and when's the variability in that arrays length gonna come in?
Vlad
variable in all caps :P
J
lol
J
and where does 'a' get its value from?
J
do you even understand what a VLA is?
Anonymous
It's probably a GCC extension