On Tuesday, 17 October 2017 at 13:27:24 UTC, Steven Schveighoffer
wrote:
I don't know what "allocations" represents, but reserve
actually calls gc_malloc, and the others do not (the space is
available to expand into the block). There should be only one
allocation IMO.
-Steve
So there
On Wednesday, 18 October 2017 at 03:48:01 UTC, Ky-Anh Huynh wrote:
Some examples in C are in [2].
My experience: Dlang has `pipe` support however the syntax is
not as clean as Bash :) Most of the times I see short (<1k loc)
Bash scripts are easy to maintain than Ruby (and now D things)
Hi,
I'm using Bash heavily in my systems. Things become slow and slow
when I have tons of scripts :) And sometimes it's not easy to
manipulate data.
You may have heard of recutils [1] which has a C extension to be
loaded by Bash. Is it possible to write similar things in D, for
Bash? I am
On Tuesday, 17 October 2017 at 08:42:09 UTC, Rene Zwanenburg
wrote:
On Tuesday, 17 October 2017 at 05:57:50 UTC, Ky-Anh Huynh wrote:
On Tuesday, 17 October 2017 at 04:56:23 UTC, ketmar wrote:
you can use libc's `putenv()` in D too, it is ok. just import
`core.sys.posix.stdlib`, it is there.
On Tuesday, 17 October 2017 at 11:49:32 UTC, Jacob Carlborg wrote:
On 2017-10-17 06:51, Ky-Anh Huynh wrote:
Hi,
Is it possible to change the current process's environment
variables?
I have looked at `std/process.d` source code, and there is
only a private method `createEnv` used when new
On 10/17/17 7:32 PM, flamencofantasy wrote:
On Tuesday, 17 October 2017 at 17:27:17 UTC, Biotronic wrote:
On Tuesday, 17 October 2017 at 15:33:02 UTC, drug wrote:
[...]
I have very little knowledge about sbrk, so here's my solution.
Tested on win32 and win64.
[...]
Try this;
unittest {
On Tuesday, 17 October 2017 at 17:27:17 UTC, Biotronic wrote:
On Tuesday, 17 October 2017 at 15:33:02 UTC, drug wrote:
[...]
I have very little knowledge about sbrk, so here's my solution.
Tested on win32 and win64.
[...]
Try this;
unittest {
int[5*1024] n;
int* p = new int;
On 10/17/17 6:04 PM, Nieto wrote:
I need to determine the operating system version. From XP to win 10. How
do I do that?
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724429(v=vs.85).aspx
-Steve
I need to determine the operating system version. From XP to win
10. How do I do that?
On Tuesday, 17 October 2017 at 17:27:17 UTC, Biotronic wrote:
On Tuesday, 17 October 2017 at 15:33:02 UTC, drug wrote:
[...]
I have very little knowledge about sbrk, so here's my solution.
Tested on win32 and win64.
[...]
Nice solution. Is `stackStart` thread local on purpose?
On 10/17/17 12:27 PM, John Burton wrote:
On Friday, 13 October 2017 at 10:35:56 UTC, Jack Applegame wrote:
If you don't want to get the great PITA, never create temporary
objects in function parameters.
I recently spent a whole day digging through my reference counted
containers library. But
17.10.2017 20:27, Biotronic пишет:
module stackCheck;
private size_t stackStart;
enum size_t pageSize = 0x1000;
static this() {
import core.stdc.stdlib : alloca;
stackStart = cast(size_t)alloca(size_t.sizeof) & ~(pageSize-1);
}
bool onStack(void* p) {
size_t end = (cast(size_t)
On Tuesday, 17 October 2017 at 15:33:02 UTC, drug wrote:
My code fails and I guess the reason is I have a slice to data
in the stack and it becomes garbage in some moment. So I need a
way to check where data is placed. Is it right that it can be
done in linux using `sbrk` so that if the addr
On Tuesday, 17 October 2017 at 15:02:29 UTC, Adam D. Ruppe wrote:
Or try this newest commit
https://github.com/adamdruppe/arsd/blob/master/terminal.d and
see if it works better for you.
Thank you Adam. The ascii thing was causing the issue in the
windows console.
Now it is working fine.
On Tuesday, 17 October 2017 at 15:02:29 UTC, Adam D. Ruppe wrote:
Or try this newest commit
https://github.com/adamdruppe/arsd/blob/master/terminal.d and
see if it works better for you.
in the commit message: ~~ascii~~ ANSI.
On Friday, 13 October 2017 at 10:35:56 UTC, Jack Applegame wrote:
If you don't want to get the great PITA, never create temporary
objects in function parameters.
I recently spent a whole day digging through my reference
counted containers library. But nasty bug was not there, but in
the
On Tuesday, 17 October 2017 at 15:02:29 UTC, Adam D. Ruppe wrote:
Or try this newest commit
https://github.com/adamdruppe/arsd/blob/master/terminal.d and
see if it works better for you.
- Here is what I use in one of my tools... and I never had
problems with German password so far ;)
More phobos-ized version:
https://run.dlang.io/is/iwgeAl
Andrea
My code fails and I guess the reason is I have a slice to data in the
stack and it becomes garbage in some moment. So I need a way to check
where data is placed. Is it right that it can be done in linux using
`sbrk` so that if the addr of data is less than `sbrk(0)` returning then
data is on
https://run.dlang.io/is/vOh6YY
Or try this newest commit
https://github.com/adamdruppe/arsd/blob/master/terminal.d and see
if it works better for you.
On Tuesday, 17 October 2017 at 12:08:57 UTC, Andre Pany wrote:
I want to read passwords from the console (should be work on
windows / linux / macos).
Do you have a little test program I can copy/paste?
I suspect this is because I called ReadConsoleInputA instead of W
for some weird reson..
On Saturday, 14 October 2017 at 09:32:32 UTC, Timon Gehr wrote:
The compiler can easily prove that the value of data.length
does not change between the two points in the program.
According to the specification, the behavior of the program is
undefined in case the assertion fails, not just the
On Tuesday, 17 October 2017 at 14:14:19 UTC, Ivan wrote:
Hi,
I am a C/C++ programmer interested in using D as a replacement
for C/C++.
I do care a lot about performance and memory management, so
I want to use my own (or from std.experimental) memory
allocators.
Are there any good tutorials
Hi,
I am a C/C++ programmer interested in using D as a replacement
for C/C++.
I do care a lot about performance and memory management, so
I want to use my own (or from std.experimental) memory
allocators.
Are there any good tutorials or examples about how to use
custom memory allocators for
On Tuesday, 17 October 2017 at 13:09:18 UTC, Nordlöw wrote:
I can't find any algorithm/range in Phobos that can be used to
split (eagerly or lazily) a sequence using a binary predicate
on adjacent elements as follows
[1,2,3,5,10,11,12,13,20,21,100].splitBy!"a + 1 != b"()
should evaluate to
On Tuesday, 17 October 2017 at 13:25:01 UTC, Nordlöw wrote:
On Tuesday, 17 October 2017 at 13:09:18 UTC, Nordlöw wrote:
Is there one?
If not, what should we call it?...yet another overload of
`splitter()` with a binary predicate and only a single
parameter `Range input`?
Would probably
On 10/17/17 2:14 AM, Tony wrote:
Found this unanswered question on StackOverflow.
This program:
import std.stdio;
void add(ref int[] data)
{
data ~= 1;
data ~= 2;
}
void main()
{
int[] a;
writeln("capacity:",a.capacity);
auto cap = a.reserve(1000); // allocated may
On 10/17/17 2:13 AM, Shriramana Sharma wrote:
Hello.
fun.d:
import std.stdio;
void fun() { writeln("Hello"); }
main.d:
import fun;
void main() { fun(); }
$ dmd -oftest fun.d main.d
main.d(2): Error: function expected before (), not module fun of type void
Why can't I use a function of the
On Tuesday, 17 October 2017 at 13:09:18 UTC, Nordlöw wrote:
Is there one?
If not, what should we call it?...yet another overload of
`splitter()` with a binary predicate and only a single parameter
`Range input`?
On 10/17/17 4:33 AM, ikod wrote:
Hello, Steve
On Friday, 13 October 2017 at 22:22:54 UTC, Steven Schveighoffer wrote:
On 10/13/17 6:18 PM, ikod wrote:
On Friday, 13 October 2017 at 19:17:54 UTC, Steven Schveighoffer wrote:
Eventually, something like this will be possible with jsoniopipe (I
I can't find any algorithm/range in Phobos that can be used to
split (eagerly or lazily) a sequence using a binary predicate on
adjacent elements as follows
[1,2,3,5,10,11,12,13,20,21,100].splitBy!"a + 1 != b"()
should evaluate to
[[1,2,3], [5], [10,11,12,13], [20,21], [100]]
.
Is there
Have reported https://issues.dlang.org/show_bug.cgi?id=17907
Hi,
I want to read passwords from the console (should be work on
windows / linux / macos).
Adam Ruppe has a quite nice library (terminal.d) which allows to
deactivating the echo to the console, which makes sense for
passwords.
But I do not get it working with terminal.d nor with std.stdio:
On 2017-10-17 06:51, Ky-Anh Huynh wrote:
Hi,
Is it possible to change the current process's environment variables?
I have looked at `std/process.d` source code, and there is only a
private method `createEnv` used when new (sub)process is created.
In C `putEnv` the answer is positive:
On 2017-10-17 04:52, Fat_Umpalumpa wrote:
I am having a lot of trouble trying to install Tango to use with D2 on
my mac os Sierra. Is this even possible? Thanks!
It can be used as a Dub package [1]. But it will not compile with the
latest version of DMD. 2.071.0 is the latest version it
On Tuesday, 17 October 2017 at 08:26:12 UTC, Daniel Kozak wrote:
You can:
import fun : fun;
Yes I found this but it is unnecessarily verbose.
At the same time I also find that it is possible to declare a
struct or class with the same name as module:
str.d:
struct str { int a; }
strmain.d:
On 2017-10-16 20:32, Andrew Edwards wrote:
You're a godsend. Thank you very much.
:D
--
/Jacob Carlborg
On Tuesday, 17 October 2017 at 08:38:20 UTC, Arjan wrote:
Before this will work, one must install the Microsoft C/C++
Addin i.e. ms-vscode.cpptools.
Start debugging and select the C++ debugger.
Yep
https://forum.dlang.org/post/xwsvxphjtzgwjyrgd...@forum.dlang.org
On Tuesday, 17 October 2017 at 08:43:33 UTC, Domain wrote:
On Tuesday, 17 October 2017 at 03:10:52 UTC, Dmitry wrote:
On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote:
Can you share your tasks.json and launch.json?
tasks.json - I don't have this file.
launch.json:
{
"version":
On Tuesday, 17 October 2017 at 03:10:52 UTC, Dmitry wrote:
On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote:
Can you share your tasks.json and launch.json?
tasks.json - I don't have this file.
launch.json:
{
"version": "0.2.0",
"configurations": [
{
On Tuesday, 17 October 2017 at 05:57:50 UTC, Ky-Anh Huynh wrote:
On Tuesday, 17 October 2017 at 04:56:23 UTC, ketmar wrote:
you can use libc's `putenv()` in D too, it is ok. just import
`core.sys.posix.stdlib`, it is there. D is not antagonistic
to C, and doesn't try to replace the whole
On Tuesday, 17 October 2017 at 03:10:52 UTC, Dmitry wrote:
On Tuesday, 17 October 2017 at 02:32:49 UTC, Domain wrote:
Can you share your tasks.json and launch.json?
tasks.json - I don't have this file.
launch.json:
{
"version": "0.2.0",
"configurations": [
{
Hello, Steve
On Friday, 13 October 2017 at 22:22:54 UTC, Steven Schveighoffer
wrote:
On 10/13/17 6:18 PM, ikod wrote:
On Friday, 13 October 2017 at 19:17:54 UTC, Steven
Schveighoffer wrote:
Eventually, something like this will be possible with
jsoniopipe (I need to update and release this
You can:
import fun : fun;
int main(string[] args)
{
fun();
return 0;
}
On Tue, Oct 17, 2017 at 10:08 AM, Shriramana Sharma via Digitalmars-d-learn
wrote:
> On Tuesday, 17 October 2017 at 07:33:15 UTC, evilrat wrote:
>
>> Compiler made that way so it
On Tuesday, 17 October 2017 at 04:01:54 UTC, Fat_Umpalumpa wrote:
Do you by any chance know anything that replaced std.xml?
Everything I look up on it suggests not to use it.
Is this really a problem? In this case, I can help: I recommend
to use it. And only if you really will have
On Tuesday, 17 October 2017 at 07:33:15 UTC, evilrat wrote:
Compiler made that way so it doesn't guess or assume too much,
because later on it will bite you when you don't even expect
that, and in some unpredictable place too.
Can you give an example for when it will bite me? It seems very
On Tuesday, 17 October 2017 at 06:38:52 UTC, Biotronic wrote:
If I understand things correctly, you only care about enums
nested in scopes up to the module scope, right? If so, this
seems to fit the bill:
enum A {a}
struct S {
enum B {b}
struct S2 {
enum C {c}
C c;
On Tuesday, 17 October 2017 at 06:13:45 UTC, Shriramana Sharma
wrote:
Hello.
fun.d:
import std.stdio;
void fun() { writeln("Hello"); }
main.d:
import fun;
void main() { fun(); }
$ dmd -oftest fun.d main.d
main.d(2): Error: function expected before (), not module fun
of type void
Why can't
On Monday, 16 October 2017 at 23:56:00 UTC, Nicholas Wilson wrote:
using fullyQualifiedName [here]
(https://github.com/libmir/dcompute/blob/master/source/dcompute/driver/ocl/util.d#L120)
leads to a large compilation slowdown, but I only need it to
disambiguate up to the module level i.e. so
On Monday, 16 October 2017 at 23:56:00 UTC, Nicholas Wilson wrote:
using fullyQualifiedName [here]
(https://github.com/libmir/dcompute/blob/master/source/dcompute/driver/ocl/util.d#L120)
leads to a large compilation slowdown, but I only need it to
disambiguate up to the module level i.e. so
Found this unanswered question on StackOverflow.
This program:
import std.stdio;
void add(ref int[] data)
{
data ~= 1;
data ~= 2;
}
void main()
{
int[] a;
writeln("capacity:",a.capacity);
auto cap = a.reserve(1000); // allocated may be more than
requested
assert(cap
Hello.
fun.d:
import std.stdio;
void fun() { writeln("Hello"); }
main.d:
import fun;
void main() { fun(); }
$ dmd -oftest fun.d main.d
main.d(2): Error: function expected before (), not module fun of
type void
Why can't I use a function of the same name as the module? IIUC
import fun
On Tuesday, 17 October 2017 at 04:56:23 UTC, ketmar wrote:
you can use libc's `putenv()` in D too, it is ok. just import
`core.sys.posix.stdlib`, it is there. D is not antagonistic to
C, and doesn't try to replace the whole libc with it's own
libraries. so if you see something that libc has
54 matches
Mail list logo