Re: Linker issues with struct postblit

2021-11-01 Thread Thomas Gregory via Digitalmars-d-learn
On Sunday, 31 October 2021 at 03:51:49 UTC, James Blachly wrote: On 10/29/21 7:10 AM, Stanislav Blinov wrote: On Friday, 29 October 2021 at 11:05:14 UTC, Imperatorn wrote: On Thursday, 28 October 2021 at 01:39:10 UTC, Thomas Gregory wrote: I am a maintainer of the [dhtslib](https://github.com/

Re: __cpuid like in C

2021-11-01 Thread rikki cattermole via Digitalmars-d-learn
I think you are wanting this? https://dlang.org/phobos/core_cpuid.html#.processor

Re: __cpuid like in C

2021-11-01 Thread Paul Backus via Digitalmars-d-learn
On Monday, 1 November 2021 at 16:00:05 UTC, Arsium wrote: Hello, Currently, I'm working to implement myself WinAPI functions. However, I could not find anything matching with : __cpuid like : https://gist.github.com/boxmein/7d8e5fae7febafc5851e Any idea ? Not sure if it's exactly the same

__cpuid like in C

2021-11-01 Thread Arsium via Digitalmars-d-learn
Hello, Currently, I'm working to implement myself WinAPI functions. However, I could not find anything matching with : __cpuid like : https://gist.github.com/boxmein/7d8e5fae7febafc5851e Any idea ?

Re: __cpuid like in C

2021-11-01 Thread Arsium via Digitalmars-d-learn
On Monday, 1 November 2021 at 16:01:38 UTC, rikki cattermole wrote: I think you are wanting this? https://dlang.org/phobos/core_cpuid.html#.processor Oh thx my bad I did not see it!

Re: __cpuid like in C

2021-11-01 Thread Arsium via Digitalmars-d-learn
On Monday, 1 November 2021 at 16:02:20 UTC, Paul Backus wrote: On Monday, 1 November 2021 at 16:00:05 UTC, Arsium wrote: Hello, Currently, I'm working to implement myself WinAPI functions. However, I could not find anything matching with : __cpuid like : https://gist.github.com/boxmein/7d8e5

Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread pascal111 via Digitalmars-d-learn
I know that I can use the next syntax to assign new value to char dynamic array, and the new value isn't in same length of the current value of the array: { char[] s="xyz".dup; s="Hello World!".dup; writeln(s); } Result: Hello World! = But what if I want to use "strcp

Re: Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/1/21 3:56 PM, pascal111 wrote: But what if I want to use "strcpy" function to assign that new value to the array that the problem is that the array won't take more than its first initializing value length: { char[] s="xyz".dup; strcpy(&s[0], "Hello World!"); writeln(s); } Result:

Re: Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread pascal111 via Digitalmars-d-learn
On Monday, 1 November 2021 at 20:15:14 UTC, Steven Schveighoffer wrote: On 11/1/21 3:56 PM, pascal111 wrote: But what if I want to use "strcpy" function to assign that new value to the array that the problem is that the array won't take more than its first initializing value length: { char[

Re: Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread Ali Çehreli via Digitalmars-d-learn
On 11/1/21 1:49 PM, pascal111 wrote: > Yes, I'm practicing doing things in low level style like standard C. All you needed extra was to let the slice know about the new length: import std.stdio; import core.stdc.string; void main() { char[] s="xyz".dup; strcpy(&s[0], "Hello World!"); s =

Re: Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread pascal111 via Digitalmars-d-learn
On Monday, 1 November 2021 at 21:01:31 UTC, Ali Çehreli wrote: On 11/1/21 1:49 PM, pascal111 wrote: > Yes, I'm practicing doing things in low level style like standard C. All you needed extra was to let the slice know about the new length: import std.stdio; import core.stdc.string; void mai

Re: Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread Ali Çehreli via Digitalmars-d-learn
On 11/1/21 2:01 PM, Ali Çehreli wrote: > The program is as incorrect as its C equivalent would be. ;) I wrote a cool function to make it easy to disregard memory safety: import std.stdio; auto assumedLength(S)(ref S slice) { struct LengthSetter { void opAssign(size_t length) { // N

Re: Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread Ali Çehreli via Digitalmars-d-learn
On 11/1/21 2:28 PM, pascal111 wrote: > This can serve the style I want. I am feeling funny right now and showing incorrect code. It's impossible to fit "Hello World!" in "xyz". As Steve said, don't do that. :) > It uses OOP style like C++ by putting a > pointer as a property, D's slices are

Re: Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread pascal111 via Digitalmars-d-learn
On Monday, 1 November 2021 at 21:32:21 UTC, Ali Çehreli wrote: On 11/1/21 2:01 PM, Ali Çehreli wrote: > The program is as incorrect as its C equivalent would be. ;) I wrote a cool function to make it easy to disregard memory safety: import std.stdio; auto assumedLength(S)(ref S slice) { s

Re: Using "strcpy" to assign value to dynamic char array

2021-11-01 Thread pascal111 via Digitalmars-d-learn
On Monday, 1 November 2021 at 21:37:59 UTC, Ali Çehreli wrote: On 11/1/21 2:28 PM, pascal111 wrote: > This can serve the style I want. I am feeling funny right now and showing incorrect code. It's impossible to fit "Hello World!" in "xyz". As Steve said, don't do that. :) > It uses OOP styl