Just a friendly reminder about using arrays in boolean conditions

Walter Bright newshound2 at digitalmars.com
Mon Nov 25 08:50:07 UTC 2024


C has an equivalent behavior distinguishing between a null pointer and a 0 
length string:

```
char *s;  // string
if (s)    // pointer
if (*s)   // length
```

```
char[] a;     // array
if (a)        // pointer
if (a.length) // length
```


More information about the Digitalmars-d mailing list