This is a good solution, Thank you!
Type: Posts; User: Concorde
This is a good solution, Thank you!
I have this piece of code:
#define NFIELDS 4
typedef union
{
int Par[NFIELDS];
struct {
int Field1;
I have tried in C. In C++ is of course the same because there are the operators overloading
In C is equivalent to use atomic types without calling atomic_load, atomic_store or atomic_fetch_add but using the standard C syntax of non atomic variables.
These 2 pieces of codes are really...
I have solved in this way:
#include <stdatomic.h>
typedef struct
{
atomic_ullong V[2];
} vectoratomic_t;
Ok, this is the code for compiler explorer try with flag -Weverything
#include <stdatomic.h>
typedef struct
{
atomic_ullong V[2];
I have this piece of code:
atomic_int Vector[2];
void Load(int *v)
{
v[0]=atomic_load(&Vector[0]);
v[1]=atomic_load(&Vector[1]);
Thank you very much for your complete answer. So for now I have:
typedef atomic_bool TMutex;
void MutexLock(TMutex *mutex)
{
while(atomic_flag_test_and_set(mutex));
}
If you use a fixed size matrix you can use:
void how(int (*array)[421][70]){
(*array)[420][69]=69;
}
Thank you for the reply. The code works but I'm not sure about the memory order of atomic_exchange and atomic_store that is memory_order_seq_cst. Is it correct for this kind of operations?
With...
I want to build a low level mutex with atomic operations but I'm not sure if it's correct. It seems to work but I'm not sure with the memory order of atomic_exchange and atomic_store. Could you help...
I'm learning c++ so it's a newbie question.
I what to put a random generator in a class because it is only used by the class.
To declare and to initialize a random numbers generator I use this...
I have 2 files, one .cpp with an array of c strings
char strings[][64]={
"One",
"Two",
"Three"};
in another .cpp file I have
Qt is not free. Does gtk have a forum for who develop gtk applications?
I need a C gui library that I can use under linux and windows with good documentation, examples and possibly a forum. What do you suggest?