digitalmars.D.learn - I can ask questions about dmd on windows here in this forum?
- Cassio Butrico (3/3) Aug 30 2014 I'm new to this language, and I wonder if I will have some
- Vladimir Panteleev (2/5) Aug 30 2014 Yes.
- Cassio Butrico (5/10) Aug 30 2014 My question is about wstring and dstring,
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (12/14) Aug 30 2014 Unless there is a specific reason not to, use 'string'. When you really
- Cassio Butrico (4/19) Aug 30 2014 Thanks so much for answering me.
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (11/13) Aug 30 2014 In addition to what Vladimir Panteleev said, you should also select a
- Cassio Butrico (5/20) Aug 30 2014 Ali Çehreli you is very attentive, answering for me.
- bearophile (4/6) Aug 31 2014 So are the use cases for wstring limited?
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (17/23) Aug 31 2014 Yes, without real experience, I am under that impression. Let's see:
- Jonathan M Davis via Digitalmars-d-learn (8/33) Aug 31 2014 On Sun, 31 Aug 2014 01:11:02 -0700
- Kagamin (4/7) Sep 02 2014 Except that dstring is not fool-proof either when one needs to
- Cassio Butrico (5/12) Sep 02 2014 I'm actually learning it because I'm sure is a beautiful and easy
- Cassio Butrico (4/17) Sep 02 2014 I miss me my TRS-80 when programmed in pascal and cobol. sorry
I'm new to this language, and I wonder if I will have some support simple questions. Thank you for your attention.
Aug 30 2014
On Sunday, 31 August 2014 at 03:16:38 UTC, Cassio Butrico wrote:I'm new to this language, and I wonder if I will have some support simple questions. Thank you for your attention.Yes.
Aug 30 2014
On Sunday, 31 August 2014 at 03:20:00 UTC, Vladimir Panteleev wrote:On Sunday, 31 August 2014 at 03:16:38 UTC, Cassio Butrico wrote:My question is about wstring and dstring, which and the best way to input data, converting and which should I useI'm new to this language, and I wonder if I will have some support simple questions. Thank you for your attention.Yes.
Aug 30 2014
On 08/30/2014 08:37 PM, Cassio Butrico wrote:My question is about wstring and dstring, which and the best way to input data, converting and which should I useUnless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'. To input data, readf() is for formatted input: int i; readf(" %s", &i); When reading a whole line as a string, consider import std.stdio; import std.string; // ... string line = chomp(readln()); Ali
Aug 30 2014
On Sunday, 31 August 2014 at 05:27:15 UTC, Ali Çehreli wrote:On 08/30/2014 08:37 PM, Cassio Butrico wrote:Thanks so much for answering me. I was having trouble setting on my terminal in windows, I'm still trying to solve.My question is about wstring and dstring, which and the best way to input data, converting and whichshould I use Unless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'. To input data, readf() is for formatted input: int i; readf(" %s", &i); When reading a whole line as a string, consider import std.stdio; import std.string; // ... string line = chomp(readln()); Ali
Aug 30 2014
On 08/30/2014 10:37 PM, Cassio Butrico wrote:I was having trouble setting on my terminal in windows, I'm still trying to solve.In addition to what Vladimir Panteleev said, you should also select a Unicode font for your terminal like Lucida Console. Basically: 1) Set the code page to 65001 by chcp 65001 2) Select a Unicode font from the console window's menu. You can set those two for the entire system. (I don't remember how.) As Vladimir Panteleev said, you can set both of those from inside each program as well. Ali
Aug 30 2014
On Sunday, 31 August 2014 at 06:08:46 UTC, Ali Çehreli wrote:On 08/30/2014 10:37 PM, Cassio Butrico wrote:Ali Çehreli you is very attentive, answering for me. I do not know how to use SetConsoleCP or SetConsoleOutputCP on a progrtama in d. I'll try to find out.I was having trouble setting on my terminal in windows, I'm still trying to solve.In addition to what Vladimir Panteleev said, you should also select a Unicode font for your terminal like Lucida Console. Basically: 1) Set the code page to 65001 by chcp 65001 2) Select a Unicode font from the console window's menu. You can set those two for the entire system. (I don't remember how.) As Vladimir Panteleev said, you can set both of those from inside each program as well. Ali
Aug 30 2014
Ali Çehreli:Unless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'.So are the use cases for wstring limited? Bye, bearophile
Aug 31 2014
On 08/31/2014 12:37 AM, bearophile wrote:Ali Çehreli:Yes, without real experience, I am under that impression. Let's see: - char is UTF-8. UTF-8 is a variable-length encoding, from 1 up to 6 bytes per character. - wchar is UTF-16. UTF-16 is a variable-length encoding, 2 or 4 bytes per character. - dchar is UTF-32. UTF-32 is a fixed-length encoding, exactly 4 bytes per characters. As I understand it, wchar would make sense when UTF-8 would take considerably more space than UTF-16 for a given text. Another case is when a wchar array is guaranteed to consist solely of 2-byte characters; it can then safely be used as a random access range. In contrast, a dchar array provides random access for any text but takes up more space for certain text than UTF-8 and UTF-16 (e.g. text consisting mostly of 1-byte characters in UTF-8 (e.g. ASCII)). So yes, wchar has limited use compared to the others. AliUnless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'.So are the use cases for wstring limited? Bye, bearophile
Aug 31 2014
On Sun, 31 Aug 2014 01:11:02 -0700 Ali Çehreli via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:On 08/31/2014 12:37 AM, bearophile wrote:The main use case for an array of wchar is to interact with Windows functions which use UTF-16. There may be rare cases to use it otherwise, but the average D program should just use string unless it needs random-access, in which case, it should use dstring. wstring is ultimately of marginal use. - Jonathan M DavisAli Çehreli:Yes, without real experience, I am under that impression. Let's see: - char is UTF-8. UTF-8 is a variable-length encoding, from 1 up to 6 bytes per character. - wchar is UTF-16. UTF-16 is a variable-length encoding, 2 or 4 bytes per character. - dchar is UTF-32. UTF-32 is a fixed-length encoding, exactly 4 bytes per characters. As I understand it, wchar would make sense when UTF-8 would take considerably more space than UTF-16 for a given text. Another case is when a wchar array is guaranteed to consist solely of 2-byte characters; it can then safely be used as a random access range. In contrast, a dchar array provides random access for any text but takes up more space for certain text than UTF-8 and UTF-16 (e.g. text consisting mostly of 1-byte characters in UTF-8 (e.g. ASCII)). So yes, wchar has limited use compared to the others.Unless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'.So are the use cases for wstring limited? Bye, bearophile
Aug 31 2014
On Sunday, 31 August 2014 at 08:37:40 UTC, Jonathan M Davis via Digitalmars-d-learn wrote:D program should just use string unless it needs random-access, in which case, it should use dstring.Except that dstring is not fool-proof either when one needs to work at grapheme level.
Sep 02 2014
On Tuesday, 2 September 2014 at 16:49:15 UTC, Kagamin wrote:On Sunday, 31 August 2014 at 08:37:40 UTC, Jonathan M Davis via Digitalmars-d-learn wrote:I'm actually learning it because I'm sure is a beautiful and easy language learning programs, so the time that there was no gui. the micros. saidades got me my TRS-80 when programmed in pascal and cobol.D program should just use string unless it needs random-access, in which case, it should use dstring.Except that dstring is not fool-proof either when one needs to work at grapheme level.
Sep 02 2014
On Tuesday, 2 September 2014 at 20:12:12 UTC, Cassio Butrico wrote:On Tuesday, 2 September 2014 at 16:49:15 UTC, Kagamin wrote:I miss me my TRS-80 when programmed in pascal and cobol. sorry hehe :)On Sunday, 31 August 2014 at 08:37:40 UTC, Jonathan M Davis via Digitalmars-d-learn wrote:I'm actually learning it because I'm sure is a beautiful and easy language learning programs, so the time that there was no gui. the micros. saidades got me my TRS-80 when programmed in pascal and cobol.D program should just use string unless it needs random-access, in which case, it should use dstring.Except that dstring is not fool-proof either when one needs to work at grapheme level.
Sep 02 2014