On Wednesday, 9 September 2015 at 19:37:54 UTC, Alex Parrill
wrote:
It's a flexible array member [1], not a pointer. Changing it to
`char*` would make it incompatible with the C functions using
it.
[1]: https://en.wikipedia.org/wiki/Flexible_array_member
TIL a new detail about C on the D for
On Wednesday, 9 September 2015 at 16:59:09 UTC, Adam D. Ruppe
wrote:
That's typically right, but since this case does it in-place
instead of pointed, the zero length array is most accurate.
I didn't consider that the name is placed right after the struct.
Thanks !
The struct core.sys.linux.sys.inotify.inotify_event contains the
field "char[0] name" which corresponds to "char name[]" in C.
Why it has been translated to "char[0]" ?
For me "char*" would have been more appropriate.
On Sunday, 19 July 2015 at 12:08:18 UTC, Adam D. Ruppe wrote:
This line is illegal:
return toHexString!(Order.decreasing)(crc.finish());
The std.digest.toHexString and variants return a *static array*
which is static data and has a scope lifetime.
It is horrendous a compiler bug that allow
On Sunday, 19 July 2015 at 12:00:23 UTC, Kagamin wrote:
http://forum.dlang.org/post/ydaeytbyxdnwlbpwk...@forum.dlang.org
Argh... must use the search function first...
If I understand correctly in my case toHexString is returning a
static char[len].
But why it gets silently converted to an im
Hello,
I get different results if I either use toHexString or
crcHexString.
I can't explain this behavior because crcHexString is just an
alias of toHexString...
Test code: http://pastebin.com/33Ye7yyJ
On Friday, 17 July 2015 at 12:58:58 UTC, Jacob Carlborg wrote:
I don't think I really understand how you want to use/call the
function. Could you give an example with all the different
types you want to call the function?
My fault, I didn't test the variadic function enough and jumped
to conc
After a thorough reading of the documentation I found an even
simpler solution:
bool hasItemParent(T)(const(char)[] itemId, T parentId)
if (is(T : const(char)[]) || is(T : const(char[])[]))
{ ... }
Now it accepts all these: char[], const(char)[],
immutable(char)[], char[][], const(char)[][] ,i
On Thursday, 16 July 2015 at 18:41:47 UTC, Gary Willoughby wrote:
bool hasItemParent(A, B)(A itemId, B parentId)
if (isSomeString!(A) && (isSomeString!(B) || isArray!(B) &&
isSomeString!(ElementType!(B
Thank you ! I completely missed isSomeString.
I think the definition can be safely shor
Thank you for all answers.
Removing typeof do resolve the problem when the second parameter
is a simple string.
However when passing an array of string the error still occur:
Error: template cache.MetadataCache.hasItemParent cannot deduce
function from argument types !()(string, string[]).
T
Hello, I can't figure how to write a template function that
accept either strings or array of strings.
This is my current code:
bool hasItemParent(T)(const(char)[] itemId, const(T)[] parentId)
if (is(typeof(T) == char) || (isArray!T && is(typeof(T[]) ==
char)))
{...}
I used const(T)[] becaus
On Thursday, 5 March 2015 at 20:16:55 UTC, anonymous wrote:
On Thursday, 5 March 2015 at 20:03:09 UTC, Benjamin Thaut wrote:
int someValue = 5;
float sameBinary = *(cast(float*)cast(void*)&someValue);
The cast(void*) isn't necessary.
Actually even the cast is unecessary, just use a uniform.
Hello,
I just discovered this strange behavior:
struct A {
void[10] x; // OK, compiles fine
}
class B {
void[10] x; // Error: void does not have a default initializer
// ! note, the message come without any line
indication !
}
Does this mean that void arrays are a thing or it
13 matches
Mail list logo