On Thursday, 28 July 2022 at 23:16:15 UTC, Paul Backus wrote:
On Thursday, 28 July 2022 at 21:52:28 UTC, pascal111 wrote:
On Thursday, 28 July 2022 at 20:36:31 UTC, Paul Backus wrote:
```d
import std.algorithm: filter;
import std.range: empty;
import std.functional: not;
// ...
auto token
On Thursday, 28 July 2022 at 23:16:15 UTC, Paul Backus wrote:
On Thursday, 28 July 2022 at 21:52:28 UTC, pascal111 wrote:
On Thursday, 28 July 2022 at 20:36:31 UTC, Paul Backus wrote:
```d
import std.algorithm: filter;
import std.range: empty;
import std.functional: not;
// ...
auto token
On Thursday, 28 July 2022 at 21:52:28 UTC, pascal111 wrote:
On Thursday, 28 July 2022 at 20:36:31 UTC, Paul Backus wrote:
```d
import std.algorithm: filter;
import std.range: empty;
import std.functional: not;
// ...
auto tokens = input
.splitter!(c => delimiters.canFind(c))
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.
- these functions can run into UB if you compile it without bound
checking enabled
- when working with arrays or ranges
On Thursday, 28 July 2022 at 20:36:31 UTC, Paul Backus wrote:
On Thursday, 28 July 2022 at 19:17:26 UTC, pascal111 wrote:
What's the "strtok" - C function - D equivalent?
https://en.cppreference.com/w/cpp/string/byte/strtok
Closest thing is probably `std.algorithm.splitter` with a
predicate:
On Thu, Jul 28, 2022 at 09:03:55PM +, pascal111 via Digitalmars-d-learn
wrote:
> On Thursday, 28 July 2022 at 19:37:31 UTC, rikki cattermole wrote:
[...]
> > foreach(value; input.splitWhen!((a, b) => delimiters.canFind(b))) {
> > writeln(value);
> > }
> > }
> > ```
>
> From wh
On Thursday, 28 July 2022 at 19:37:31 UTC, rikki cattermole wrote:
I don't know of a D version, although it should be pretty easy
to write up yourself.
But you can always use strtok itself.
https://github.com/dlang/dmd/blob/09d04945bdbc0cba36f7bb1e19d5bd009d4b0ff2/druntime/src/core/stdc/string
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov wrote:
I'm at a dead end, please help, guys.
1. Can you try with `ldc2 --march=32bit-mode`? The march list
(--march=help) details this as "32-bit mode (80386)".
2. Can you try with `ldc2 --march=i586 -betterC` with a simple
BetterC
On Thursday, 28 July 2022 at 19:17:26 UTC, pascal111 wrote:
What's the "strtok" - C function - D equivalent?
https://en.cppreference.com/w/cpp/string/byte/strtok
Closest thing is probably `std.algorithm.splitter` with a
predicate:
```d
import std.algorithm: splitter, canFind;
import std.std
On Thursday, 28 July 2022 at 17:46:49 UTC, frame wrote:
On Thursday, 28 July 2022 at 16:45:55 UTC, pascal111 wrote:
Aha! "In theory, someone could inject bad code", you admit my
theory.
The code would need to work and pass merge tests too. The merge
reason must match in review. If someone fi
I don't know of a D version, although it should be pretty easy to write
up yourself.
But you can always use strtok itself.
https://github.com/dlang/dmd/blob/09d04945bdbc0cba36f7bb1e19d5bd009d4b0ff2/druntime/src/core/stdc/string.d#L97
Very similar to example given on the docs:
```d
void main()
What's the "strtok" - C function - D equivalent?
https://en.cppreference.com/w/cpp/string/byte/strtok
On Thursday, 28 July 2022 at 16:03:46 UTC, Alexander Zhirov wrote:
[...]
How did you manage to get hold of this compiler?
```
/root/usr/program/gcc/9.5.0/install/bin/cc
```
Where does this compiler come from?
This is an unpacked archive from an official source from the
GNU website
https:/
On Thursday, 28 July 2022 at 16:45:55 UTC, pascal111 wrote:
Aha! "In theory, someone could inject bad code", you admit my
theory.
The code would need to work and pass merge tests too. The merge
reason must match in review. If someone fixes a task and
additionally adds 100 LOC some should, wi
On Thursday, 28 July 2022 at 17:21:57 UTC, H. S. Teoh wrote:
On Thu, Jul 28, 2022 at 04:45:55PM +, pascal111 via
Digitalmars-d-learn wrote:
[...]
In theory, Ken Thompson's compromised compiler hack could be at
work[1].
[...]
I think you say advanced technical information. My informati
On Thu, Jul 28, 2022 at 04:45:55PM +, pascal111 via Digitalmars-d-learn
wrote:
> On Thursday, 28 July 2022 at 16:37:35 UTC, frame wrote:
> > On Thursday, 28 July 2022 at 16:17:16 UTC, pascal111 wrote:
> >
> > > My friend, there is a wide deep secret world for hackers. We have
> > > no any ide
On Thursday, 28 July 2022 at 16:37:35 UTC, frame wrote:
On Thursday, 28 July 2022 at 16:17:16 UTC, pascal111 wrote:
My friend, there is a wide deep secret world for hackers. We
have no any idea about that world. Look, there is nothing
called a 100% fact in our world. Believe me, what we see in
On Thursday, 28 July 2022 at 16:17:16 UTC, pascal111 wrote:
My friend, there is a wide deep secret world for hackers. We
have no any idea about that world. Look, there is nothing
called a 100% fact in our world. Believe me, what we see in
software is just what "THEY" want us to see.
I think
On Thursday, 28 July 2022 at 15:38:18 UTC, H. S. Teoh wrote:
On Thu, Jul 28, 2022 at 03:10:19PM +, pascal111 via
Digitalmars-d-learn wrote:
> [...]
[...]
[...]
AFAIK, all D compilers ship with full Phobos source code. On my
installation, it's in
/usr/lib/gcc/x86_64-linux-gnu/11/include
On Thursday, 28 July 2022 at 16:13:17 UTC, frame wrote:
On Thursday, 28 July 2022 at 14:57:36 UTC, pascal111 wrote:
well between US and some other countries like "Russia", and
they are using US products like C compilers, so with some way
we have a doubt that US developed compilers with a way t
On Thursday, 28 July 2022 at 14:57:36 UTC, pascal111 wrote:
well between US and some other countries like "Russia", and
they are using US products like C compilers, so with some way
we have a doubt that US developed compilers with a way to
accept kind of messages or something like that, so my
On Thursday, 28 July 2022 at 15:55:04 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 14:57:36 UTC, pascal111 wrote:
[...]
Sure. What effect do YOU hope to causes or prevent by writing
```
/**/
```
between all of your functions?
I'm normal programmer,
On Thursday, 28 July 2022 at 15:25:00 UTC, Alexander Zhirov wrote:
[...]
Everything falls on the same error.
```sh
checking for suffix of object files... configure: error: in
`/home/thinstation/source/gcc/12.1.0/build/i586-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object
On Thursday, 28 July 2022 at 16:02:11 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 15:25:00 UTC, Alexander Zhirov
wrote:
On Thursday, 28 July 2022 at 13:16:26 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 12:45:51 UTC, Alexander Zhirov
wrote:
[...]
I have already downloaded the latest GCC
On Thursday, 28 July 2022 at 15:25:00 UTC, Alexander Zhirov wrote:
On Thursday, 28 July 2022 at 13:16:26 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 12:45:51 UTC, Alexander Zhirov
wrote:
[...]
I have already downloaded the latest GCC sources, nothing
compiles anyway.
How did you manage t
On Thursday, 28 July 2022 at 14:57:36 UTC, pascal111 wrote:
[...]
Sure. What effect do YOU hope to causes or prevent by writing
```
/**/
```
between all of your functions?
I'm normal programmer, by mean that I'm not so expert in C
matters to know reall
On Thu, Jul 28, 2022 at 03:10:19PM +, pascal111 via Digitalmars-d-learn
wrote:
> On Thursday, 28 July 2022 at 15:03:34 UTC, H. S. Teoh wrote:
> > On Thu, Jul 28, 2022 at 02:30:38PM +, pascal111 via
> > Digitalmars-d-learn wrote: [...]
> > > Of-course D has a built in "sgn" function, but I
On Thursday, 28 July 2022 at 15:03:34 UTC, H. S. Teoh wrote:
Just use the source, Luke! Phobos is open source for a reason.
https://github.com/dlang/phobos/blob/8280b1e7de6cca4dc9a593431591054a5b3aa288/std/math/traits.d#L694
T
:-)
```d
// @@@TODO@@@: make this faster
```
On Thursday, 28 July 2022 at 13:16:26 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 12:45:51 UTC, Alexander Zhirov
wrote:
[...]
I have already downloaded the latest GCC sources, nothing
compiles anyway.
How did you manage to get hold of this compiler?
```
/root/usr/program/gcc/9.5.0/instal
On Thursday, 28 July 2022 at 15:03:34 UTC, H. S. Teoh wrote:
On Thu, Jul 28, 2022 at 02:30:38PM +, pascal111 via
Digitalmars-d-learn wrote: [...]
Of-course D has a built in "sgn" function, but I like to do it
with my hands to be sure of code, I'm some doubtful and don't
trust alien works.
On Thu, Jul 28, 2022 at 02:30:38PM +, pascal111 via Digitalmars-d-learn
wrote:
[...]
> Of-course D has a built in "sgn" function, but I like to do it with my
> hands to be sure of code, I'm some doubtful and don't trust alien
> works.
Just use the source, Luke! Phobos is open source for a re
On Thursday, 28 July 2022 at 14:44:53 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 13:58:24 UTC, pascal111 wrote:
[...]
Precisely in what way? I am not kidding. I am seriously
asking the question: In what way may a C or C++ compiler
benefit from lines between functions which contain only
co
On Thursday, 28 July 2022 at 13:58:24 UTC, pascal111 wrote:
[...]
Precisely in what way? I am not kidding. I am seriously asking
the question: In what way may a C or C++ compiler benefit from
lines between functions which contain only comments consisting
of nothing else than asterisks?
Seriou
On Thursday, 28 July 2022 at 12:13:31 UTC, Antonio wrote:
On Thursday, 28 July 2022 at 12:02:54 UTC, pascal111 wrote:
I'm making an equivalent of "sgn" function of BASIC language,
and I used "(T)" in its definition, but the function can
receive wrong data by passing string data to it, how we ca
On Thursday, 28 July 2022 at 13:29:01 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 12:44:19 UTC, pascal111 wrote:
[...]
Do you think it helps the compiler if you put these
`/**/`
between your functions? Or is there anybody else who benefits
from it?
On Thursday, 28 July 2022 at 13:06:03 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 12:25:05 UTC, pascal111 wrote:
[...]
ofix.c: In function 'fix':
ofix.c:7:3: warning: 'z' is used uninitialized
[-Wuninitialized]
7 | y=modf(x,z);
| ^
ofix.c:5:12: note: 'z' was declared h
On Monday, 25 July 2022 at 13:17:41 UTC, Moth wrote:
or was the .lst extension chosen arbitrarily?
my text editor [notepad++] thinks it's COBOL for some reason
but that's obviously not correct, so i'm wondering if it has an
official spec or anything. knowing the name of it would help -
maybe
On Thursday, 28 July 2022 at 12:44:19 UTC, pascal111 wrote:
[...]
Do you think it helps the compiler if you put these
`/**/`
between your functions? Or is there anybody else who benefits
from it?
"Do you think it helps the compiler if you put these"
Ar
On Thursday, 28 July 2022 at 12:45:51 UTC, Alexander Zhirov wrote:
[...]
I have already downloaded the latest GCC sources, nothing
compiles anyway.
How did you manage to get hold of this compiler?
```
/root/usr/program/gcc/9.5.0/install/bin/cc
```
Everything falls on the same error.
```sh
c
On Thursday, 28 July 2022 at 12:25:05 UTC, pascal111 wrote:
[...]
ofix.c: In function 'fix':
ofix.c:7:3: warning: 'z' is used uninitialized
[-Wuninitialized]
7 | y=modf(x,z);
| ^
ofix.c:5:12: note: 'z' was declared here
5 | double y,* z;
|^
```
I woul
On Thursday, 28 July 2022 at 12:02:54 UTC, pascal111 wrote:
I'm making an equivalent of "sgn" function of BASIC language,
and I used "(T)" in its definition, but the function can
receive wrong data by passing string data to it, how we can
solve it?
There's no need to do the complication of a
On Thursday, 28 July 2022 at 12:36:59 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 12:26:50 UTC, pascal111 wrote:
[...]
Aha! you mean "/**/",
it has no job, just to separate between functions codes.
Do you think it helps the compiler if you put these
On Thursday, 28 July 2022 at 11:40:09 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 10:39:06 UTC, Alexander Zhirov
wrote:
[...]
I don't understand what I need to do.
You wrote
At first I thought that I needed to rebuild the GCC
compiler for the i586
architecture. I downloaded GCC
On Thursday, 28 July 2022 at 12:26:50 UTC, pascal111 wrote:
[...]
Aha! you mean "/**/",
it has no job, just to separate between functions codes.
Do you think it helps the compiler if you put these
`/**/`
between
On Thursday, 28 July 2022 at 12:13:31 UTC, Antonio wrote:
Use isFloating!T and isIntegral!T traits.
The standard library **sng** function is a good example:
https://dlang.org/library/std/math/traits/sgn.html
```d
import std.traits : isFloatingPoint, isIntegral;
int sgn(T)(T x) if (isFloat
On Thursday, 28 July 2022 at 12:15:19 UTC, kdevel wrote:
On Wednesday, 27 July 2022 at 18:19:34 UTC, pascal111 wrote:
[...]
1. What exact purpose do these
```
/**/
```
[...]
Aha! you mean "/**/", it
has no job
On Thursday, 28 July 2022 at 12:15:19 UTC, kdevel wrote:
On Wednesday, 27 July 2022 at 18:19:34 UTC, pascal111 wrote:
I made a library of some useful functions while I was studying
C, and I'm curious to know if D has equivalents or some ones
for some of my functions, or I have to retype 'em aga
On Wednesday, 27 July 2022 at 18:19:34 UTC, pascal111 wrote:
I made a library of some useful functions while I was studying
C, and I'm curious to know if D has equivalents or some ones
for some of my functions, or I have to retype 'em again in D.
The library link:
https://github.com/pascal111-
On Thursday, 28 July 2022 at 12:02:54 UTC, pascal111 wrote:
I'm making an equivalent of "sgn" function of BASIC language,
and I used "(T)" in its definition, but the function can
receive wrong data by passing string data to it, how we can
solve it?
Use isFloating!T and isIntegral!T traits.
On Thursday, 28 July 2022 at 11:13:19 UTC, Dennis wrote:
On Wednesday, 27 July 2022 at 18:19:34 UTC, pascal111 wrote:
The library link:
https://github.com/pascal111-fra/turbo-c-programs/blob/main/COLLECT2.H
It would help if the functions had a comment explaining what
they're supposed to do, b
I'm making an equivalent of "sgn" function of BASIC language, and
I used "(T)" in its definition, but the function can receive
wrong data by passing string data to it, how we can solve it?
int sgn(T)(T x)
{
if(x<0)
return -1;
else if(x>0)
return 1;
else
retu
On Thursday, 28 July 2022 at 10:39:06 UTC, Alexander Zhirov wrote:
[...]
I don't understand what I need to do.
You wrote
At first I thought that I needed to rebuild the GCC compiler
for the i586
architecture. I downloaded GCC 9.5.0 and started the
installation:
Then you wrote that
So, I've came to a situation where I must use mixin template for
defining members overloads, like:
```d
mixin template OverloadGen()
{
static if(hasMethod!(typeof(this), "add", int, int))
{
float add(float x, float y){return x+y;}
}
static if(hasMethod!(typeof(this), "mul"
On Wednesday, 27 July 2022 at 18:19:34 UTC, pascal111 wrote:
The library link:
https://github.com/pascal111-fra/turbo-c-programs/blob/main/COLLECT2.H
It would help if the functions had a comment explaining what
they're supposed to do, but it looks like most of them are string
functions. In D,
On Thursday, 28 July 2022 at 10:26:36 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov
wrote:
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov
wrote:
```sh
/root/usr/program/gcc/9.5.0/install/bin/cc app.o -o app
-L/root/usr/program/ldc/1.30/install/lib
On Thursday, 28 July 2022 at 00:46:19 UTC, pascal111 wrote:
On Thursday, 28 July 2022 at 00:36:54 UTC, ryuukk_ wrote:
I don't remember the exact syntax for GDC, but it should be
pretty similar to DMD
You need to pass the module to the compiler
gdc main.d dcollect.d
I'm using CODE::BLOCK
On Thursday, 28 July 2022 at 10:26:36 UTC, kdevel wrote:
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov
wrote:
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov
wrote:
```sh
/root/usr/program/gcc/9.5.0/install/bin/cc app.o -o app
-L/root/usr/program/ldc/1.30/install/lib
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov wrote:
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov
wrote:
```sh
/root/usr/program/gcc/9.5.0/install/bin/cc app.o -o app
-L/root/usr/program/ldc/1.30/install/lib -lphobos2-ldc
-ldruntime-ldc -Wl,--gc-sections -lrt -ldl
On Thursday, 28 July 2022 at 07:16:13 UTC, user1234 wrote:
that would be something like `--mcpu=i686 --mattrs=-mmx,-sse`
and maybe more to be sure.
Fails...
```sh
# ldc2 --mcpu=i686 --mattr=-mmx,-sse app.d
# ./app
Illegal instruction
```
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov wrote:
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov
> x86- 32-bit X86: Pentium-Pro and above
I also tried with `i586` and `pentium` - the result is the same.
Pentium Pro and above means at least i686. i586 is Pentium
On Thursday, 28 July 2022 at 07:16:13 UTC, user1234 wrote:
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov
wrote:
[...]
Pentium Pro and above means at least i686. i586 is Pentium1
which is less featured.
That means that you cant do much, however you can try to tune
the i686 targe
61 matches
Mail list logo