Re: Error: variable foo conflicts with struct foo

2018-01-04 Thread Stijn via Digitalmars-d-learn
On Thursday, 4 January 2018 at 17:59:55 UTC, Colin wrote: How can the compiler know which symbol is which symbol if everything has the same name? Standard practice is to capitalise type names and camelCase variable names. The C# compiler has no trouble understanding code like that, so I

Error: variable foo conflicts with struct foo

2018-01-04 Thread Stijn via Digitalmars-d-learn
Why is it not allowed for a variable name to match a type name? The following example fails with "Error: variable foo conflicts with struct foo" struct foo {} foo foo;

Re: Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread Stijn via Digitalmars-d-learn
On Sunday, 24 December 2017 at 01:29:56 UTC, rikki cattermole wrote: Although maybe you ought to start out with regular D. -betterC is really there for those who want D but can't have druntime. They should already know D pretty well. I'm using -betterC on purpose, doing bare-metal

Re: Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread Stijn via Digitalmars-d-learn
On Sunday, 24 December 2017 at 01:21:53 UTC, rikki cattermole wrote: On 24/12/2017 1:20 AM, Stijn wrote: [...] new uses GC. It has nothing to do with structs. Oh I see, simply removing 'new' solves the problem. I've a C# background, so I hadn't thought of doing that. Thanks!

Why does calling a struct constructor generate linker errors when using Better C?

2017-12-23 Thread Stijn via Digitalmars-d-learn
https://dlang.org/spec/betterc.html doesn't mention struct constructors not working, but I'm getting linker errors when trying to call a struct constructor. Consider the following program betterc.d struct foo { } extern(C) void main() { auto bar = new foo(); }

What is the absolute minimum code for a D kernel, and how should it be compiled?

2015-01-06 Thread Stijn via Digitalmars-d-learn
After writing a bootloader and getting it to jump to a Hello World kernel written in assembly, I want to give it a go with a kernel written in D. I'm using GDC because I didn't have much luck with making DMD skip the D runtime and standard libs. Starting with this code: void main() { }

Re: What is the absolute minimum code for a D kernel, and how should it be compiled?

2015-01-06 Thread Stijn via Digitalmars-d-learn
On Tuesday, 6 January 2015 at 22:41:06 UTC, Adam D. Ruppe wrote: I showed how to do it in my book using dmd. Here's the code: http://arsdnet.net/dcode/book/chapter_11/01/ I've just bought the book, I'll dive right into it :) Thanks!