On Friday, 15 October 2021 at 20:33:33 UTC, JN wrote:
Is there some nice way of achieving something like this C99
code in D?
[...]
The
[literal](https://www.ibm.com/docs/sr/xl-c-and-cpp-aix/13.1.0?topic=operators-compound-literal-expressions) in the C version creates an alloca too but it's h
On Friday, 15 October 2021 at 21:47:21 UTC, Paul Backus wrote:
static global(alias value) = value;
I fear there will be issues with reentrancy.
On Friday, 15 October 2021 at 21:47:21 UTC, Paul Backus wrote:
On Friday, 15 October 2021 at 20:33:33 UTC, JN wrote:
Is there some nice way of achieving something like this C99
code in D?
```c
#include
typedef struct {
int x, y;
} inputs_t;
void foo(inputs_t* optional_inputs)
{
if (
On Friday, 15 October 2021 at 21:19:35 UTC, jfondren wrote:
On Friday, 15 October 2021 at 20:33:33 UTC, JN wrote:
Is there some nice way of achieving something like this C99
code in D?
option 1: use an intermediate lambda:
```d
import std.stdio;
struct inputs_t {
int x, y;
} // no ; need
On Friday, 15 October 2021 at 20:33:33 UTC, JN wrote:
Is there some nice way of achieving something like this C99
code in D?
```c
#include
typedef struct {
int x, y;
} inputs_t;
void foo(inputs_t* optional_inputs)
{
if (!optional_inputs) {
printf("0 0\n");
} else {
On Friday, 15 October 2021 at 20:33:33 UTC, JN wrote:
Is there some nice way of achieving something like this C99
code in D?
option 1: use an intermediate lambda:
```d
import std.stdio;
struct inputs_t {
int x, y;
} // no ; needed here
void foo(inputs_t* optional_inputs) {
if (!optio
You could use `Nullable` from the standard library to achieve
something similar, but it isn't as simple/nice as your C99
compound literal example:
```D
import std.stdio;
import std.typecons; //
https://dlang.org/phobos/std_typecons.html#Nullable
struct inputs_t { int x, y; };
void foo(Nulla
Is there some nice way of achieving something like this C99 code
in D?
```c
#include
typedef struct {
int x, y;
} inputs_t;
void foo(inputs_t* optional_inputs)
{
if (!optional_inputs) {
printf("0 0\n");
} else {
printf("%d %d \n", optional_inputs->x,
optional_inpu