Re: I don't understand betterC

2023-09-04 Thread confused via Digitalmars-d-learn
On Saturday, 2 September 2023 at 07:59:31 UTC, Jonathan M Davis wrote: If you put it into a package, then you could have your own object module that then isn't at the top level - e.g. mypkg/object.d with module mypkg.object; but you can't have more than one module in your program with the sa

Re: I don't understand betterC

2023-09-01 Thread confused via Digitalmars-d-learn
On Friday, 1 September 2023 at 13:45:05 UTC, evilrat wrote: It is shadowing default implicit "import object;", here a demonstration ```d // this example shows default implicit import of "object" module // compile this example: // ldc2 -c test.d // output: // tuple("object", "core", "main",

Re: I don't understand betterC

2023-09-01 Thread confused via Digitalmars-d-learn
On Saturday, 2 September 2023 at 01:05:39 UTC, ryuukk_ wrote: If you are looking for a better C you are not looking for classes You contradict yourself If you heard about betterC, then you heard about this: https://dlang.org/spec/betterc.html Read it again, and specially this part: https:

Re: I don't understand betterC

2023-09-01 Thread confused via Digitalmars-d-learn
On Friday, 1 September 2023 at 13:31:37 UTC, bachmeier wrote: You can read the documentation for object.d [here](https://dlang.org/phobos/object.html). It's kind of important. I'm not sure which specific part of the documentation was supposed to illuminate the exact nature of that error.

Re: I don't understand betterC

2023-09-01 Thread confused via Digitalmars-d-learn
On Friday, 1 September 2023 at 08:19:55 UTC, Richard (Rikki) Andrew Cattermole wrote: ``size_t`` is defined in ``object.d`` which is implicitly imported into all modules. If it cannot be found, one of three things is happening: 1) You have messed with some cli args related to picking druntime

Re: I don't understand betterC

2023-08-31 Thread confused via Digitalmars-d-learn
On Thursday, 31 August 2023 at 18:42:57 UTC, Richard (Rikki) Andrew Cattermole wrote: ```d extern(C) int main() { import core.stdc.stdio; string hello = "hello"; printf(hello.ptr); return 0; } ``` 1) You forgot to import ``core.stdc.stdio`` 2) String literal is of type string (

I don't understand betterC

2023-08-31 Thread confused via Digitalmars-d-learn
I decided to try out betterC with the most trivial example I could think of, but why doesn't this work? ```d extern(C) int main() { char[] hello = "hello"; printf(hello); return 0; } ```