Re: Obsecure problem 1

2022-07-30 Thread frame via Digitalmars-d-learn
On Saturday, 30 July 2022 at 23:40:44 UTC, pascal111 wrote: Provide me a free solution better than code::blocks with available gdc compiler I found. SDB@79 I don't know if's "better" but there is Visual Studio Code and IntelliJ IDEA for example. Yeah ctrl+v doesn't work on XTERM, the mid

Re: Does anyone here know how to create a Telegram bot in D?

2022-07-30 Thread Murilo via Digitalmars-d-learn
On Saturday, 30 July 2022 at 05:12:23 UTC, AnimusPEXUS wrote: so basically you have to do http-client programming also there's some outdated tg packages in repo https://code.dlang.org/search?q=telegram Thanks you very much.

Re: Obsecure problem 1

2022-07-30 Thread pascal111 via Digitalmars-d-learn
Another version of the program: https://github.com/pascal111-fra/D/blob/main/proj04.d

Re: Obsecure problem 1

2022-07-30 Thread pascal111 via Digitalmars-d-learn
On Saturday, 30 July 2022 at 22:45:14 UTC, Salih Dincer wrote: On Saturday, 30 July 2022 at 22:17:10 UTC, pascal111 wrote: The program works fine now: https://i.postimg.cc/3wkgXmVs/Screenshot-from-2022-07-31-00-04-23.png I have a suggestion for you. Use modern possibilities instead of applyi

Re: Obsecure problem 1

2022-07-30 Thread pascal111 via Digitalmars-d-learn
On Saturday, 30 July 2022 at 22:28:52 UTC, frame wrote: On Saturday, 30 July 2022 at 22:13:55 UTC, pascal111 wrote: Because copying the running window contents is not allowed, I couldn't do it in Code::Blocks. Not allowed? o.O Did you try to select the text and insert it via middle mouse bu

Re: Obsecure problem 1

2022-07-30 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 30 July 2022 at 22:17:10 UTC, pascal111 wrote: The program works fine now: https://i.postimg.cc/3wkgXmVs/Screenshot-from-2022-07-31-00-04-23.png I have a suggestion for you. Use modern possibilities instead of applying functions used in the past to the present. For example, in a

Re: Obsecure problem 1

2022-07-30 Thread frame via Digitalmars-d-learn
On Saturday, 30 July 2022 at 22:13:55 UTC, pascal111 wrote: Because copying the running window contents is not allowed, I couldn't do it in Code::Blocks. Not allowed? o.O Did you try to select the text and insert it via middle mouse button in another window? Those terminals usually copy the

Re: Obsecure problem 1

2022-07-30 Thread pascal111 via Digitalmars-d-learn
On Saturday, 30 July 2022 at 21:48:35 UTC, rikki cattermole wrote: It is a pretty straight forward. You tried to access memory out of bounds of the slice. https://github.com/pascal111-fra/D/blob/main/dcollect.d#L34 That for loop is problematic in a number of ways. You should not use int, or u

Re: Obsecure problem 1

2022-07-30 Thread pascal111 via Digitalmars-d-learn
On Saturday, 30 July 2022 at 21:52:42 UTC, frame wrote: On Saturday, 30 July 2022 at 21:24:50 UTC, pascal111 wrote: I've typed a code to enjoy with my library "dcollect", and found non-understandable error: ... Running screen says: https://i.postimg.cc/G3YyCmbF/Screenshot-from-2022-07-30-23-

Re: Obsecure problem 1

2022-07-30 Thread frame via Digitalmars-d-learn
On Saturday, 30 July 2022 at 21:24:50 UTC, pascal111 wrote: I've typed a code to enjoy with my library "dcollect", and found non-understandable error: ... Running screen says: https://i.postimg.cc/G3YyCmbF/Screenshot-from-2022-07-30-23-23-59.png Why you don't copy the output instead? A ran

Re: Obsecure problem 1

2022-07-30 Thread rikki cattermole via Digitalmars-d-learn
It is a pretty straight forward. You tried to access memory out of bounds of the slice. https://github.com/pascal111-fra/D/blob/main/dcollect.d#L34 That for loop is problematic in a number of ways. You should not use int, or uint to index into memory, only size_t should be used. It is an alia

Obsecure problem 1

2022-07-30 Thread pascal111 via Digitalmars-d-learn
I've typed a code to enjoy with my library "dcollect", and found non-understandable error: module main; import std.stdio; import dcollect; import std.string; import std.conv; int main(string[] args) { string sentence_x, sent_result, token2; string[] sentence_tokens;

Re: Some user-made C functions and their D equivalents

2022-07-30 Thread frame via Digitalmars-d-learn
On Saturday, 30 July 2022 at 17:55:02 UTC, pascal111 wrote: I don't understand much the posting details of this forum. https://forum.dlang.org/help#about It's simple: if you want to format/style your posts rather then just using plain text, enable the Markdown option. It's similar to Gith

Re: Is this a violation of const?

2022-07-30 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 30 July 2022 at 10:34:09 UTC, ag0aep6g wrote: You're not making sense. Your `s` is mutable, not immutable. You're right! I saw the hole at the end of the tunnel late 😀 But if you compile the example below without the `new operator`, the system does not work and does not give any

Re: Some user-made C functions and their D equivalents

2022-07-30 Thread pascal111 via Digitalmars-d-learn
On Thursday, 28 July 2022 at 23:08:15 UTC, frame wrote: On Thursday, 28 July 2022 at 20:20:27 UTC, pascal111 wrote: I retyped again some function of C library I made before, but with D code: It's a start but you need to learn. Thanks! I made the equivalent of my C library "collect": https:

Re: Is this a violation of const?

2022-07-30 Thread Timon Gehr via Digitalmars-d-learn
On 7/30/22 15:19, Salih Dincer wrote: On Saturday, 30 July 2022 at 10:02:50 UTC, Timon Gehr wrote: It's a `const` hole, plain and simple. This code, which consists of 26 lines, does not compile in DMD 2.087.  I am getting this error: constHole.d(15): Error: mutable method `source.Updater.o

Re: Is this a violation of const?

2022-07-30 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 30 July 2022 at 10:02:50 UTC, Timon Gehr wrote: It's a `const` hole, plain and simple. This code, which consists of 26 lines, does not compile in DMD 2.087. I am getting this error: constHole.d(15): Error: mutable method `source.Updater.opCall` is not callable using a `const`

Re: Is this a violation of const?

2022-07-30 Thread ag0aep6g via Digitalmars-d-learn
On 30.07.22 09:15, Salih Dincer wrote: It's possible to do this because it's immutable.  You don't need an extra update() function anyway. ```d void main() {     auto s = S("test A");     s.update = (_) { s.s = _; };     s.update("test B");     assert(s.s == "test B");     s.s = "test C"

Re: Is this a violation of const?

2022-07-30 Thread Timon Gehr via Digitalmars-d-learn
On 7/30/22 00:16, H. S. Teoh wrote: On Fri, Jul 29, 2022 at 09:56:20PM +, Andrey Zherikov via Digitalmars-d-learn wrote: In the example below `func` changes its `const*` argument. Does this violates D's constness? ```d import std; struct S { string s; void delegate(string s) up

Re: Is this a violation of const?

2022-07-30 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 30 July 2022 at 06:04:16 UTC, ag0aep6g wrote: Yes. Here's a modified example to show that you can also violate `immutable` this way: It's possible to do this because it's immutable. You don't need an extra update() function anyway. ```d void main() { auto s = S("test A")