Re: Recommended coding convention for combining unix and windows code ?

2016-06-08 Thread Olivier Pisano via Digitalmars-d-learn
Hi, I personally separate OS-specific implementations in modules with the same name, in different directories. From the filesystem perspective: widget.d linux/widgetimpl.d windows/widgetimpl.d From the code perspective, the *impl modules would present homonymic types with the same public

Re: Recommended coding convention for combining unix and windows code ?

2016-06-07 Thread wobbles via Digitalmars-d-learn
On Tuesday, 7 June 2016 at 15:33:57 UTC, chmike wrote: Hello I'm writing some code that I want to be portable across Posix and Windows. What is the recommended code convention for such type of code ? 80% of the class implementation is the same for both OS. Should I write the following and

Re: Recommended coding convention for combining unix and windows code ?

2016-06-07 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 7 June 2016 at 15:33:57 UTC, chmike wrote: or should I do it the C way with multiple embedded static if... In your example, `version` would also work instead of `static if`. I would not copy much code needlessly, and go with the embedded version/static ifs. - Johan

Re: Recommended coding convention for combining unix and windows code ?

2016-06-07 Thread FreeSlave via Digitalmars-d-learn
On Tuesday, 7 June 2016 at 15:33:57 UTC, chmike wrote: Hello I'm writing some code that I want to be portable across Posix and Windows. What is the recommended code convention for such type of code ? 80% of the class implementation is the same for both OS. Should I write the following and

Recommended coding convention for combining unix and windows code ?

2016-06-07 Thread chmike via Digitalmars-d-learn
Hello I'm writing some code that I want to be portable across Posix and Windows. What is the recommended code convention for such type of code ? 80% of the class implementation is the same for both OS. Should I write the following and copy past the 80% version( Windows ) { import