Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Andrew Edwards via Digitalmars-d-learn
On 5/14/16 12:35 AM, Steven Schveighoffer wrote: On 5/13/16 12:59 AM, Andrew Edwards wrote: On 5/13/16 8:40 AM, Andrew Edwards wrote: That seems wrong. You can't assign to an enum. Besides, doesn't your declaration of MIN shadow whatever other definitions may be currently in effect? Okay,

Re: Defining member fuctions of a class or struct out side of the class/struct body?

2016-05-13 Thread Ali Çehreli via Digitalmars-d-learn
On 05/13/2016 11:41 AM, Jamal wrote: Warning D newb here. Is it possible to define a member function outside of the class/struct like in C++; class x { body void foo(int* i); }; void x::foo(int* i){ *i++; } Or is it just D-like to define everything inside the class/struct body?

Re: Defining member fuctions of a class or struct out side of the class/struct body?

2016-05-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/13/16 2:41 PM, Jamal wrote: Warning D newb here. Is it possible to define a member function outside of the class/struct like in C++; Not within the same file. You can have an "interface file", extension .di, which hides the bodies of functions. But inside the implementation file, you

Defining member fuctions of a class or struct out side of the class/struct body?

2016-05-13 Thread Jamal via Digitalmars-d-learn
Warning D newb here. Is it possible to define a member function outside of the class/struct like in C++; class x { body void foo(int* i); }; void x::foo(int* i){ *i++; } Or is it just D-like to define everything inside the class/struct body?

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread sanjayss via Digitalmars-d-learn
On Thursday, 12 May 2016 at 22:51:17 UTC, Andrew Edwards wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif

Re: imports && -run [Bug?]

2016-05-13 Thread zabruk70 via Digitalmars-d-learn
On Friday, 13 May 2016 at 06:33:40 UTC, Jacob Carlborg wrote: Even better is to use "rdmd" which will automatically track and compile dependencies. but i should warn about annoing bug with local import http://forum.dlang.org/post/mailman.1984.1373610213.13711.digitalmar...@puremagic.com

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Kagamin via Digitalmars-d-learn
On Thursday, 12 May 2016 at 22:51:17 UTC, Andrew Edwards wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/13/16 12:59 AM, Andrew Edwards wrote: On 5/13/16 8:40 AM, Andrew Edwards wrote: That seems wrong. You can't assign to an enum. Besides, doesn't your declaration of MIN shadow whatever other definitions may be currently in effect? Okay, got it. It seams I just hadn't hit that bug yet

Re: imports && -run [Bug?]

2016-05-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-05-13 08:27, Andrew Edwards wrote: I fail to see why the compiler would be less capable at this task than rdmd. Since it is already build to accept multiple input files and knows more about what's going on during compilation than rdmd will ever know, in does not make sense that it

Re: DMD flag -gs and -gx

2016-05-13 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 13 May 2016 at 10:19:04 UTC, Nordlöw wrote: -gsalways emit stack frame IIRC, not emitting a stack frame is an optimization which confuses debuggers. So I think this can be used to make optimized builds a bit easier to debug. -gxadd stack stomp code

Re: How to split a string/array with multiple separators?

2016-05-13 Thread Thorsten Sommer via Digitalmars-d-learn
Wow, thanks Steve :)

DMD flag -gs and -gx

2016-05-13 Thread Nordlöw via Digitalmars-d-learn
What role does the DMD flags -gs and -gx play? The documentation says -gsalways emit stack frame -gxadd stack stomp code which I don't know what it means.

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Andrew Edwards via Digitalmars-d-learn
On 5/13/16 3:23 PM, tsbockman wrote: On Friday, 13 May 2016 at 06:05:14 UTC, Andrew Edwards wrote: Additionally, what's the best way to handle nested #ifdef's? Those that appear inside structs, functions and the like... I know that global #ifdef's are turned to version blocks but versions

Re: imports && -run [Bug?]

2016-05-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-05-13 08:10, tsbockman wrote: According to the DMD compiler manual, the -run switch only accepts a single source file: -run srcfile args... After the first source file, any further arguments passed to DMD will be interpreted as arguments to be passed to the program being run. To

Re: imports && -run [Bug?]

2016-05-13 Thread Andrew Edwards via Digitalmars-d-learn
On 5/13/16 3:10 PM, tsbockman wrote: On Friday, 13 May 2016 at 01:16:36 UTC, Andrew Edwards wrote: command: dmd -run mod inc output: Undefined symbols for architecture x86_64: "_D3inc5printFZv", referenced from: __Dmain in mod.o ld: symbol(s) not found for architecture x86_64 clang:

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread tsbockman via Digitalmars-d-learn
On Friday, 13 May 2016 at 06:05:14 UTC, Andrew Edwards wrote: Additionally, what's the best way to handle nested #ifdef's? Those that appear inside structs, functions and the like... I know that global #ifdef's are turned to version blocks but versions blocks cannot be used inside classes,

Re: imports && -run [Bug?]

2016-05-13 Thread tsbockman via Digitalmars-d-learn
On Friday, 13 May 2016 at 01:16:36 UTC, Andrew Edwards wrote: command: dmd -run mod inc output: Undefined symbols for architecture x86_64: "_D3inc5printFZv", referenced from: __Dmain in mod.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread Andrew Edwards via Digitalmars-d-learn
On 5/13/16 7:51 AM, Andrew Edwards wrote: The following preprocessor directives are frequently encountered in C code, providing a default constant value where the user of the code has not specified one: #ifndef MIN #define MIN 99 #endif #ifndef MAX #define MAX

Re: Request assistance converting C's #ifndef to D

2016-05-13 Thread tsbockman via Digitalmars-d-learn
On Friday, 13 May 2016 at 04:59:23 UTC, Andrew Edwards wrote: Is there a way to reproduce the same behavior? Are there reason's for not allowing this functionality or am I just misunderstanding and going about things the wrong way? [1] same result whether placed before or after the