Re: Integer precision of function return types

2024-09-26 Thread monkyyy via Digitalmars-d-learn
On Friday, 27 September 2024 at 04:23:32 UTC, thinkunix wrote: What about using 'auto' as the return type? I tried it and it seemed to work OK. Wondering if there are any good reasons to use auto, or bad reasons why not to use auto here? You have started a style debate that will last a week,

Re: Integer precision of function return types

2024-09-26 Thread thinkunix via Digitalmars-d-learn
Per Nordlöw via Digitalmars-d-learn wrote: Should a function like ```d uint parseHex(in char ch) pure nothrow @safe @nogc { switch (ch) { case '0': .. case '9':     return ch - '0'; case 'a': .. case 'f':     return 10 + ch - 'a'; case 'A': .. case 'F':     ret

Re: Integer precision of function return types

2024-09-26 Thread Quirin Schroll via Digitalmars-d-learn
On Thursday, 26 September 2024 at 06:53:12 UTC, Per Nordlöw wrote: Should a function like ```d uint parseHex(in char ch) pure nothrow @safe @nogc { switch (ch) { case '0': .. case '9': return ch - '0'; case 'a': .. case 'f': return 10 + ch

Re: Integer precision of function return types

2024-09-26 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 26 September 2024 at 06:53:12 UTC, Per Nordlöw wrote: Should a function like ```d uint parseHex(in char ch) pure nothrow @safe @nogc { switch (ch) { case '0': .. case '9': return ch - '0'; case 'a': .. case 'f': return 10 + ch

Re: Integer precision of function return types

2024-09-26 Thread user1234 via Digitalmars-d-learn
On Thursday, 26 September 2024 at 06:53:12 UTC, Per Nordlöw wrote: Should a function like ```d uint parseHex(in char ch) pure nothrow @safe @nogc { switch (ch) { case '0': .. case '9': return ch - '0'; case 'a': .. case 'f': return 10 + ch

Re: Integer precision of function return types

2024-09-26 Thread monkyyy via Digitalmars-d-learn
On Thursday, 26 September 2024 at 06:53:12 UTC, Per Nordlöw wrote: Should a function like ```d uint parseHex(in char ch) pure nothrow @safe @nogc { switch (ch) { case '0': .. case '9': return ch - '0'; case 'a': .. case 'f': return 10 + ch