Parra
use this construction:
Parra
#ifdef __cplusplus
extern "C" {
#endif
// declarations
#ifdef __cplusplus
}
#endif
Parra
you have here the example:
Parra
https://github.com/metacall/core/blob/develop/source/format/include/format/format_print.h
Pete
So it goes directly into the code? Rather than being called on like somewhat a header file would
Parra
Parra
if it does not use it
Parra
then you have to wrap the include like this:
Parra
#ifdef __cplusplus
extern "C" {
#endif
#include <your_c_code.h>
#ifdef __cplusplus
}
#endif
Parra
if that header already uses this construction then you can include it directly without anything extra
CM
Guys any idea why this program is not compiling
CM
When i compile and run it always giving me info that your program not compiled
Kat
Well actuate Windows or install Linux first of all
Kat
Second of all, try a different compiler
CM
CM
Mahbøøb
Helo.
Mahbøøb
Any one here can difrentiate between. Function overloading and function Overriding. ??
BinaryByter
Idea for addition to the C++ standard: template<class T>
class lockable_data {
T& operator->();
T& operator*();
void lock();
void unlock();
};
the idea is to group a mutex and some data into a single class
BinaryByter
what do you guys think?
Dima
this is not intuitive
BinaryByter
How not so?
Dima
mhh
BinaryByter
It would, on the other hand, reduce the amount of helper classes needed in threading
BinaryByter
or of global variables
MᏫᎻᎯᎷᎷᎬᎠ
Dima
std::string goes = "skraaah";
BinaryByter
True, atomic does that
BinaryByter
?
BinaryByter
This isnt the same ^^
BinaryByter
BinaryByter
this is
BinaryByter
same as with mutex
BinaryByter
advised use would be in a lock guard
Ludovic 'Archivist'
Same as with mutex, locking more than once per thread is a noop
BinaryByter
are you a mitbuster?
Mits
Thank u @MissRose_bot n no I m not @linuxer4fun 😅
BinaryByter
pretty much, yes
BinaryByter
BinaryByter
or just
lock_guard, since its templated
Ludovic 'Archivist'
Mutexes use the thread_id for locking so that a thread cannot self-deadlock
Mits
BinaryByter
BinaryByter
Well then you'd have a noop
BinaryByter
as you said earlier
BinaryByter
But lock_data doesnt care
BinaryByter
since it just wraps a mutex
Ludovic 'Archivist'
BinaryByter
Oh okay
MᏫᎻᎯᎷᎷᎬᎠ
Ludo won this round lol
BinaryByter
Wat?
MᏫᎻᎯᎷᎷᎬᎠ
Nothing
BinaryByter
Lol
BinaryByter
So in overall, do you deem lockable_data to be a good idea?
Ludovic 'Archivist'
no
Ludovic 'Archivist'
hwo do you swap two lockable data ?
BinaryByter
BinaryByter
Or you wait until both are unlocked
BinaryByter
BinaryByter
You dont
lets stick with that then
Mits
Can't I send any link?
Dima
I will take a look
Dima
no, you cant send that
Dima
Mits
Oh k.. thank u 😊
Mits
😂😅
Death Killer
Has anyone solved *NPTEL assignment c++*
Anonymous
Guys I have a question . Well I searched many times how to create 3D objects in c++ and got this
Anonymous
Anonymous
but how to make it realistic like this ?
Anonymous
klimi
Make shaders
Anonymous
Make shaders
well do you know any source or any guide for this ?
klimi
I know only some OpenGL
klimi
Learnopengl.com