Weird bug in std.logger? Possible memory corruption

2023-10-31 Thread Arafel via Digitalmars-d-learn
Hi, Today I have just found a weird bug in std.logger. Consider: ```d import std.logger : info; void main() { info(foo()); } auto foo() { info("In foo"); return "Hello, world."; } ``` The output is: ``` 2023-10-31T20:41:05.274 [info] onlineapp.d:8:foo In foo

Function Overloading

2023-10-31 Thread Salih Dincer via Digitalmars-d-learn
```d struct Calculate {   int memory; string result;    auto toString() => result;    this(string str)    {        add(str);    }    this(int num) {        add(num); } import std.string : format;    void add(string str)    {        result ~= str.format!"%s + ";  

Re: bigEndian in std.bitmanip

2023-10-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 31, 2023 8:23:28 AM MDT Salih Dincer via Digitalmars-d- learn wrote: > On Tuesday, 31 October 2023 at 10:24:56 UTC, Jonathan M Davis > > wrote: > > On Tuesday, October 31, 2023 4:09:53 AM MDT Salih Dincer via > > > > Digitalmars-d- learn wrote: > >> Hello, > >> > >> Why isn't

Re: bigEndian in std.bitmanip

2023-10-31 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 31 October 2023 at 10:09:53 UTC, Salih Dincer wrote: Hello, Why isn't Endian.littleEndian the default setting for read() in std.bitmanip? Okay, we can easily change this if we want (I could use enum LE in the example) and I can also be reversed with data.retro.array(). ```d

Re: bigEndian in std.bitmanip

2023-10-31 Thread Salih Dincer via Digitalmars-d-learn
On Tuesday, 31 October 2023 at 10:24:56 UTC, Jonathan M Davis wrote: On Tuesday, October 31, 2023 4:09:53 AM MDT Salih Dincer via Digitalmars-d- learn wrote: Hello, Why isn't Endian.littleEndian the default setting for read() in std.bitmanip? Why would you expect little endian to be the

Re: bigEndian in std.bitmanip

2023-10-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, October 31, 2023 4:09:53 AM MDT Salih Dincer via Digitalmars-d- learn wrote: > Hello, > > Why isn't Endian.littleEndian the default setting for read() in > std.bitmanip? Why would you expect little endian to be the default? The typical thing to do when encoding integral values in a

bigEndian in std.bitmanip

2023-10-31 Thread Salih Dincer via Digitalmars-d-learn
Hello, Why isn't Endian.littleEndian the default setting for read() in std.bitmanip? Okay, we can easily change this if we want (I could use enum LE in the example) and I can also be reversed with data.retro.array(). ```d void main() { import std.conv : hexString; string helloD =