4 days ago Learn » Re: maybe a noreturn issue | |||
|---|---|---|---|
| |||
...parameters, if (0), strongly pure functions returning void etc. In my experience, doing this rarely... | |||
4 days ago General » Something like ADL from C++? | |||
|---|---|---|---|
| |||
...serialise;
void serialise(T)(void[] buffer, T)
if (isSomeInt!T)
{ /* serialise integer */ }
void serialise(void... | |||
4 days ago Learn » Re: volatile struct definition for peripheral control registers | |||
|---|---|---|---|
| |||
...return volatileLoad(&value);
}
alias read this;
public void opAssign(T value)
{
volatileStore(&this.value, value... | |||
5 days ago Learn » Re: volatile struct definition for peripheral control registers | |||
|---|---|---|---|
| |||
...std.string : format;
import std.stdio : writeln;
void main()
{
enum text = "sixtwoone";
auto test = FixedStr... | |||
5 days ago Learn » Re: what's the use of empty structs in C-style languages ? | |||
|---|---|---|---|
| |||
...being 1, today this passes:
struct S {}
void main() {
S[2] ses;
assert(&ses[0... | |||
5 days ago Learn » volatile struct definition for peripheral control registers | |||
|---|---|---|---|
| |||
...T v;
T get()
{
return volatileLoad(&v);
}
void opAssign(T v)
{
volatileStore(&this.v, v... | |||
5 days ago Learn » Search on Shared array and return | |||
|---|---|---|---|
| |||
...user.username == username)
{
return user;
}
}
return null;
}
void main()
{
shared User alice = new shared User... | |||
5 days ago Learn » Re: Variable modified by different threads. | |||
|---|---|---|---|
| |||
...int gInt;
void initialize(int initialValue = 0)
{
mutex = new Mutex();
gInt = initialValue;
}
void increment(int... | |||
5 days ago Learn » Re: Variable modified by different threads. | |||
|---|---|---|---|
| |||
...Method to safely increment the global variable
void increment(int value)
{
synchronized(mutex)
{
gInt.atomicOp... | |||
6 days ago Learn » Re: Variable modified by different threads. | |||
|---|---|---|---|
| |||
...the thread function.
void modify(int increment) {
while (!stopRequested) {
g.atomicOp!"+="(increment);
}
}
void main() {
// Spawn... | |||
Copyright © 1999-2021 by the D Language Foundation