On Tuesday, August 20, 2019 5:48:04 PM MDT ads via Digitalmars-d-learn
wrote:
> This piece of code creates a fizzbuzz string with template
> parameters.
>
> auto fizzbuzz(uint N)() {
> string accumulate;
> return fizzbuzz!N(accumulate);
> }
>
> auto fizzbuzz(uint N)(ref string result) if (N %
On 21.08.19 01:48, ads wrote:
This piece of code creates a fizzbuzz string with template parameters.
auto fizzbuzz(uint N)() {
string accumulate;
return fizzbuzz!N(accumulate);
}
auto fizzbuzz(uint N)(ref string result) if (N % 3 && N % 5) {
import std.conv : to;
result ~=
On Wednesday, 21 August 2019 at 00:04:37 UTC, H. S. Teoh wrote:
On Tue, Aug 20, 2019 at 11:48:04PM +, ads via
Digitalmars-d-learn wrote: [...]
2) Deducing the string as you describe would require CTFE
(compile-time function evaluation), which usually isn't done
unless the result is
On Tuesday, 20 August 2019 at 23:48:04 UTC, ads wrote:
https://godbolt.org/z/hWENgc
A somewhat similar translation in C++ also creates a lot of
runtime instructions
https://godbolt.org/z/psyUtq
On Tue, Aug 20, 2019 at 11:48:04PM +, ads via Digitalmars-d-learn wrote:
[...]
> In the generated assembly, it looks like it is creating a lot of
> runtime instructions, contrary to my belief that templated codes are
> purely compile-time. I was expecting that the compiler would deduce
> the
This piece of code creates a fizzbuzz string with template
parameters.
auto fizzbuzz(uint N)() {
string accumulate;
return fizzbuzz!N(accumulate);
}
auto fizzbuzz(uint N)(ref string result) if (N % 3 && N % 5) {
import std.conv : to;
result ~= N.to!string ~
On Tuesday, 20 August 2019 at 17:33:17 UTC, lili wrote:
Hi:
With gcc we can use _ attribute _((section("name")) var; how
to same in dlang?
As for C(++), not standardized in the language itself. With LDC:
import ldc.attributes : section;
@section("name")
__gshared int myGlobal;
On Tuesday, 20 August 2019 at 17:29:15 UTC, Dennis wrote:
On Tuesday, 20 August 2019 at 17:17:01 UTC, Vladimirs Nordholm
wrote:
[...]
Importing only specifies that you expect the symbols to be
there, it doesn't mean the functions are linked in.
[...]
Thank you for the explanation Dennis.
Hi:
With gcc we can use _ attribute _((section("name")) var; how
to same in dlang?
On Tuesday, 20 August 2019 at 17:17:01 UTC, Vladimirs Nordholm
wrote:
In code I have `import core.sys.windows.winuser;`, but still
get this error.
Importing only specifies that you expect the symbols to be there,
it doesn't mean the functions are linked in.
On Windows there are three
Hello.
I recently reinstalled Windows 10 (build 1903), and downloaded
DMD (v2.087.1) and dub (v1.16.0).
My project no longer compiles, giving the following errors:
error LNK2019: unresolved external symbol GetSystemMetrics
referenced in [...]
error LNK2019: unresolved external
On Tuesday, 20 August 2019 at 11:51:03 UTC, Daniel Kozak wrote:
For that you can use https://dlang.org/phobos/std_file#append
Don't do that. It will reopen and close the file on every
received chunk. Not only is it slow, but if the file is
renamed/moved/deleted while the download is
On Tue, Aug 20, 2019 at 12:52:31PM +, BoQsc via Digitalmars-d-learn wrote:
[...]
> I found https://dlang.org/phobos/dmd_console.html and wanted to use
> it. But it seems I'm not being successful, and I do not understand
> why.
[...]
Because this is code inside the compiler, when you're
On Tuesday, 20 August 2019 at 12:52:31 UTC, BoQsc wrote:
Hello everyone, again,
I had an idea that I want some colors in the output of Command
Line (For Windows) and the Terminal (For Linux)
yesterday was talks about terminal colors in IRC-channel:
u can use VT-codes for changing colors:
On Tuesday, 20 August 2019 at 11:33:33 UTC, Anders S wrote:
I'm creating an application that connect to a database and
write data from another application. Now when I start the
application I want it to check if the database exists and if
not create the database and it's tables.
I have
On Tue, Aug 20, 2019 at 2:55 PM BoQsc via Digitalmars-d-learn
wrote:
>
> Hello everyone, again,
>
> I had an idea that I want some colors in the output of Command
> Line (For Windows) and
> the Terminal (For Linux)
>
> I found https://dlang.org/phobos/dmd_console.html and wanted to
> use it.
>
On Tuesday, 20 August 2019 at 12:52:31 UTC, BoQsc wrote:
And the output says that, dmd.console; do not exist?
These are for when you are working on the compiler's source
itself.
Hello everyone, again,
I had an idea that I want some colors in the output of Command
Line (For Windows) and
the Terminal (For Linux)
I found https://dlang.org/phobos/dmd_console.html and wanted to
use it.
But it seems I'm not being successful, and I do not understand
why.
Here, you can
On Tuesday, 20 August 2019 at 11:51:03 UTC, Daniel Kozak wrote:
For that you can use https://dlang.org/phobos/std_file#append
Thank you, seems to work.
import std.net.curl : HTTP;
import std.stdio: writeln;
import std.file : append;
void main()
{
auto http = HTTP();
// Track
On Tue, Aug 20, 2019 at 1:40 PM BoQsc via Digitalmars-d-learn
wrote:
>
> Hello everyone,
> I found this snippet on
> https://dlang.org/phobos/std_net_curl.html#.HTTP
>
> > import std.net.curl : HTTP;
> > import std.stdio : writeln;
> >
> > void main()
> > {
> > auto http = HTTP();
> > //
On Tue, Aug 20, 2019 at 1:46 PM Daniel Kozak wrote:
>
> On Tue, Aug 20, 2019 at 1:40 PM BoQsc via Digitalmars-d-learn
> wrote:
> >
> > Hello everyone,
> > I found this snippet on
> > https://dlang.org/phobos/std_net_curl.html#.HTTP
> >
> > > import std.net.curl : HTTP;
> > > import std.stdio :
Hello everyone,
I found this snippet on
https://dlang.org/phobos/std_net_curl.html#.HTTP
import std.net.curl : HTTP;
import std.stdio : writeln;
void main()
{
auto http = HTTP();
// Track progress
http.method = HTTP.Method.get;
http.url =
I'm creating an application that connect to a database and write
data from another application. Now when I start the application I
want it to check if the database exists and if not create the
database and it's tables.
I have everything working IF the database and tables exist.
Use this code
Today we look at how to save images using Cairo with examples for
JPeg, PNG, BMP, and TIFF.
https://gtkdcoding.com/2019/08/20/0063-cairo-vii-draw-save-images.html
On Tuesday, 20 August 2019 at 09:49:21 UTC, Daniel Kozak wrote:
On Tue, Aug 20, 2019 at 11:30 AM ads via Digitalmars-d-learn
wrote:
you do not allow a person to think about a problem (and it’s easy
here).
you carried him through a puddle now, but when he dives into Sea
D, you will not be
On Tuesday, August 20, 2019 3:27:36 AM MDT ads via Digitalmars-d-learn
wrote:
> import std.stdio;
>
> ubyte[] extend(in uint[] arr)
> {
> ubyte[] result;
> foreach (n; arr)
> {
> if (n < 10)
> {
> result ~= n;
> // source/app.d(10,11): Error:
On Tuesday, 20 August 2019 at 09:27:36 UTC, ads wrote:
import std.stdio;
ubyte[] extend(in uint[] arr)
{
ubyte[] result;
foreach (n; arr)
{
if (n < 10)
result ~= n;
else
{
On Tue, Aug 20, 2019 at 11:30 AM ads via Digitalmars-d-learn
wrote:
>
>
> How can I get around this? I want to ensure that the array is not
> mutated in the function in the signature too.
>
https://run.dlang.io/is/tehp3j
import std.stdio;
ubyte[] extend(in uint[] arr)
{
ubyte[] result;
Hello,
I've recently decided to pick up D, and have started doing some
exercises on
https://exercism.io/ (a non-profit programming exercise
platform), which I think is an excellent way to pick up the
basics in a new language.
While doing the exercises on my own is rewarding already, I would
import std.stdio;
ubyte[] extend(in uint[] arr)
{
ubyte[] result;
foreach (n; arr)
{
if (n < 10)
{
result ~= n;
// source/app.d(10,11): Error: cannot
append type const(uint) to type ubyte[]
30 matches
Mail list logo