Re: How would the equivalent C type be in D?

2023-03-07 Thread rempas via Digitalmars-d-learn
On Tuesday, 7 March 2023 at 09:05:45 UTC, FeepingCreature wrote: Yay! Yes, that is a bit weird. First of all, the actual signal is 11 [...] Thank you for the info!

Re: How would the equivalent C type be in D?

2023-03-07 Thread FeepingCreature via Digitalmars-d-learn
On Wednesday, 1 March 2023 at 09:37:48 UTC, rempas wrote: Thank you! You are amazing for explaining it! I was so focused on thinking that I'm doing something wrong with the type that I didn't noticed that the pointers, points to nowhere so the function obviously has nowhere to write to.

Re: How would the equivalent C type be in D?

2023-03-07 Thread FeepingCreature via Digitalmars-d-learn
On Wednesday, 1 March 2023 at 09:37:48 UTC, rempas wrote: Thank you! You are amazing for explaining it! I was so focused on thinking that I'm doing something wrong with the type that I didn't noticed that the pointers, points to nowhere so the function obviously has nowhere to write to.

Re: How would the equivalent C type be in D?

2023-03-01 Thread rempas via Digitalmars-d-learn
On Wednesday, 1 March 2023 at 08:26:07 UTC, FeepingCreature wrote: 11 is SIGSEGV. A segfault, or access violation, happens when you try to access unallocated memory. In this case, let me annotate your code so it's easier to see what's happening: ```d // null is the default value for a

Re: How would the equivalent C type be in D?

2023-03-01 Thread FeepingCreature via Digitalmars-d-learn
On Wednesday, 1 March 2023 at 08:26:07 UTC, FeepingCreature wrote: ```d uint32_t[1] value; value[0] = screen.black_pixel; xcb_create_gc(connection, black, win, mask, value.ptr); ``` To expand on this: ```d uint32_t[2] value; uint32_t* value_ptr = value.ptr; // We are allowed to access the

Re: How would the equivalent C type be in D?

2023-03-01 Thread FeepingCreature via Digitalmars-d-learn
On Wednesday, 1 March 2023 at 08:12:05 UTC, rempas wrote: I'm looking into [this](https://www.x.org/releases/X11R7.7/doc/libxcb/tutorial/index.html) tutorial to learn XCB and I'm trying to write the code in D with betterC. In the section 9.1 (sorry, I cannot give a section link, the article does

How would the equivalent C type be in D?

2023-03-01 Thread rempas via Digitalmars-d-learn
I'm looking into [this](https://www.x.org/releases/X11R7.7/doc/libxcb/tutorial/index.html) tutorial to learn XCB and I'm trying to write the code in D with betterC. In the section 9.1 (sorry, I cannot give a section link, the article does not give us this ability), I'm facing a problem and my