Hi all,
I'm porting some C++ code into D that uses istream to read lines like
label 3
where there can spaces or tabs between the 2 fields. In c++, this is:
string l;
int i;
istr l i;
What's the equivalent in D? It appears that D formatted read for
strings grabs everything up to a newline
bearophile bearophileh...@lycos.com writes:
Jerry:
If I do
f.readf(%s %s, l, i);
it fails if the whitespace is a tab.
In you can use byLine, followed by a split, and then assignment of the pieces,
followed by to!int where necessary.
I actually can't use byLine in this instance. I'm
John Colvin john.loughran.col...@gmail.com writes:
On Tuesday, 17 June 2014 at 13:16:38 UTC, Jerry wrote:
bearophile bearophileh...@lycos.com writes:
Jerry:
If I do
f.readf(%s %s, l, i);
it fails if the whitespace is a tab.
In you can use byLine, followed by a split, and then
Hello guys, as the title says I'm getting a SIGSEGV when trying
to use a D DLL.
Let's take a look on this C++ code:
extern "C" __declspec(dllimport) void D_user_fillEngine(const
char* workDir, void* engine);
extern "C" __declspec(dllimport) int D_user_startUp();
extern "C"
On Tuesday, 23 February 2016 at 11:10:30 UTC, Mike Parker wrote:
I'm surprised you're able to get an executable when linking
with the import library.
I actually just tried a bunch of extern(?), extern "?"
combinations and it compiled.
If you want 32-bit COFF output from DMD, you'll need
I have a small problem with using UCS when sorting arrays. This
pops a warning telling me to use the algorithm sort instead of
the property sort. Which I understand why it works that way.
However that means I can not have syntactic sugar. So is there
any way around this or do I just have to
On Thursday, 7 April 2016 at 13:17:32 UTC, Jerry wrote:
On Thursday, 7 April 2016 at 13:13:14 UTC, Suliman wrote:
dup upgdare
dub upgdare
Tried that. I have to say this is odd.
I generated a visuald project and tried that. Now suddenly it is
working as expected. So I guess it's a bug in
Hello, I am trying to use vibe with DMD 2.67, dub and windows.
But in some way the default main function is sneaking in my build
system even when I'm using VibeCustomMain version.
Main file:
import vibe.vibe;
void main() {
writeln("Hello world");
}
And dub file:
{
"targetType":
On Thursday, 7 April 2016 at 13:13:14 UTC, Suliman wrote:
dup upgdare
dub upgdare
Tried that. I have to say this is odd.
I am really not used to bash scripts.
I am trying to use Dustmite on my project since I have started
getting an
"Assertion failure: '0' in glue.c on line 1492" and really can
not find any issue about it in the issue tracker.
So I want to pass my DUB project to Dustmite and use findstr bash
On Tuesday, 22 March 2016 at 09:19:27 UTC, Vladimir Panteleev
wrote:
On Tuesday, 22 March 2016 at 09:11:52 UTC, Jerry wrote:
So I want to pass my DUB project to Dustmite and use findstr
For reducing dub projects, try the "dub dustmite" command, e.g.
"--compiler-regex=Assertion failure".
On Tuesday, 26 July 2016 at 19:02:32 UTC, Gorge Jingale wrote:
I might want to actually use Add internally in B so I can add
some elements behind the scenes, I do not want to expose it to
the outside world though.
There are no way to remove things from an template directly. But
you could
On Friday, 15 July 2016 at 08:11:13 UTC, nik wrote:
//unittest
//{
// auto result_1 = Result!(void, string)(void);
// auto result_2 = Result!(void, string)(void);
// assert(result_1.is_result);
// assert(result_1 == result_2);
//}
You wanted to handle the void case?
Unittests have to be inside a module to be run on DMD atleast.
So putting module foo at top should fix it.
On Friday, 20 January 2017 at 22:47:17 UTC, Xavier Bigand wrote:
Hi,
I am writing some code with opengl commands that I want to
check in debug, so I am using the function checkgl (from
glamour lib).
The issue is that checkgl throw exception and can't be @nogc, I
had try to use
On Tuesday, 24 January 2017 at 12:01:35 UTC, Jonathan M Davis
wrote:
So, while it makes sense to say that .ptr can't be used in
@safe code, it really doesn't make sense to suggest [0] as
an alternative.
- Jonathan M Davis
Sure I see your point. But I feel like deprecations should also
list
I am trying to do opApply to work when the delegate passed when
it is and isn't nogc/nothrow. As soon as you involve a template
though, type inference goes out the door. I want to be able to
use opApply with templates (to get the auto @nogc/nothrow
deducation passed on the delegate passed) but
You can use the C++ plugin, which provides a debugger. Just make
sure you aren't using optlink, I don't think it generates
compatible files. Also you might need to use "-gc" which
generates debug names to be in C format.
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
On Thursday, 16 February 2017 at 04:09:18 UTC, Basile B. wrote:
No, by any chance do you ask this for the tuple unpacking PR ?
If so I've also tried and failed.
Was just trying to use a container I created in functions with
and without @nogc/nothrow.
On Thursday, 25 August 2016 at 20:42:42 UTC, Illuminati wrote:
http://judy.sourceforge.net/downloads/10minutes.htm
Would be nice to have such an implementation. Supposedly one of
the best all around data structures in existence? Maybe D could
be used to make them work with arbitrary
On Monday, 7 November 2016 at 21:37:50 UTC, Picaud Vincent wrote:
static if ( isIntegralConstant!(typeof(required_capacity()) )
{
}
else
{
}
}
Premature post send by error sorry Well something like:
static if ( isIntegralConstant!(typeof(required_capacity()) )
On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent wrote:
template isIntegralConstant(ANY)
{
enum bool
isIntegralConstant=__traits(identifier,ANY)=="IntegralConstant";
}
A bit more elegant way of doing that would be:
enum isIntegralConstant(T) = is(T : IntegralConstant!U, U...);
The problem is with how isInputRange is defined, requires that
front be copyable.
auto h = r.front; // can get the front of the range
https://github.com/dlang/phobos/blob/v2.072.1/std/range/primitives.d#L168
It doesn't take into consideration that front exists and that
it's a reference to a
On Thursday, 8 December 2016 at 16:48:07 UTC, H. S. Teoh wrote:
On Thu, Dec 08, 2016 at 04:35:02PM +, Jerry via
Digitalmars-d-learn wrote:
The problem is with how isInputRange is defined, requires that
front be copyable.
auto h = r.front; // can get the front of the range
https
On Thursday, 8 December 2016 at 17:29:42 UTC, H. S. Teoh wrote:
The problem is that most range algorithms won't work if `auto h
= r.front;` doesn't compile. Random chunks of std.algorithm
won't work for such a range.
One may argue, of course, that std.algorithm ought to be
fixed... but the
On Thursday, 8 December 2016 at 21:46:26 UTC, Jonathan M Davis
wrote:
However, at least as of C++98, non-copyable elements in a
container were not allowed IIRC, so it would have been pretty
rare to have a C++ iterator that returned a non-copyable value
when you dereferenced it.
Even if it was
On Thursday, 8 December 2016 at 23:08:35 UTC, Jonathan M Davis
wrote:
I've seen that in C++ code all the time, especially if you're
dealing with
smart pointers, because otherwise you have to do stuff like
(*iter)->foo()
instead of just var->foo().
Smart pointers weren't introduced until
On Monday, 28 November 2016 at 11:26:41 UTC, dm wrote:
```
abstract class MyClass(T)
{
public:
@property const(T) value(){return _value;}
@property void value(T val){_value = val;}
...
private:
T _value;
...
}
To avoid having to use the Object class directly you can make an
base
On Tuesday, 29 November 2016 at 15:56:23 UTC, Jerry wrote:
abstract class MyClass {}
abstract class MyClassImpl(T)
Oops, forgot MyClassImpl should extend from MyClass.
abstract class MyClassImpl(T) : MyClass {
...
}
On Thursday, 1 December 2016 at 00:36:30 UTC, Jake Pittis wrote:
How do I convert a double to a ubyte[]?
I've tried all sorts of things including converting the double
to a ulong and trying to serialize the ulong. For example test
bellow fails.
unittest {
double d = 3.14;
ulong
On Friday, 30 December 2016 at 05:24:56 UTC, Jeremy DeHaan wrote:
On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan
wrote:
How does one correctly add a linker path that has spaces?
The quotes get consumed by the command line.
On Friday, 30 December 2016 at 05:24:56 UTC, Jeremy DeHaan wrote:
On Friday, 30 December 2016 at 04:56:59 UTC, Jerry wrote:
On Friday, 30 December 2016 at 03:51:13 UTC, Jeremy DeHaan
wrote:
How does one correctly add a linker path that has spaces?
The quotes get consumed by the command line.
On Monday, 26 December 2016 at 21:15:03 UTC, Adam D. Ruppe wrote:
On Monday, 26 December 2016 at 20:07:56 UTC, crimaniak wrote:
// I want to see Foo here and use it's reflection to
iterate fields and methods.
then pass foo to it
What do you mean parent symbol? I assumed you mean
On Friday, 17 March 2017 at 17:13:48 UTC, Russel Winder wrote:
I have a bit of code:
string[] returnValue;
foreach(string key, string[] value; groups) {
returnValue ~=
value.sort!debianPackageNumberComparator()[0..$-1].array;
}
return returnValue;
[...]
On Monday, 17 April 2017 at 18:07:36 UTC, Jonathan M Davis wrote:
Non-copyable types tend to wreak havoc with things
- Jonathan M Davis
Basicly what I use this for is to combine RAII with ranges.
Which I find quite useful when doing DB queries and the data is
lazily fetched
since this allows
On Monday, 17 April 2017 at 18:07:36 UTC, Jonathan M Davis wrote:
In this particular case, it looks like the main problem is
RefRange's opAssign. For it to work, the type needs to be
copyable. It might be reasonable for RefRange to be enhanced so
that it doesn't compile in opAssign if the
Hello guys, so I wanted to have a noncopyable range on the stack.
So my thoughts was to make it non copyable and use refRange
whenever I want to use it with map and others.
But I got a compiler warning when doing so like this:
import std.range;
void main() {
NonCopyable v;
On Sunday, 12 March 2017 at 18:49:22 UTC, data pulverizer wrote:
Hello all,
I am attempting to write templates for differently qualified
types using specialisations. Below is an example for const and
non-const outlining my approach:
``
import std.stdio : writeln;
You have to use "export" for any symbol to be visible from a dll.
On Windows by default nothing is exported.
On Tuesday, 16 May 2017 at 08:32:56 UTC, Nordlöw wrote:
What's the status of atomicity of file-copying and -moving
(renaming) using std.file on different platforms?
Niall has a good talk about this on youtube:
https://www.youtube.com/watch?v=uhRWMGBjlO8
Note that you also probably need extern(C++) on the struct ImVec2.
https://github.com/ParticlePeter/imgui_lib/blob/master/source/imgui/types.d#L84
On Sunday, 21 May 2017 at 19:33:06 UTC, ParticlePeter wrote:
I am statically linking to ImGui [1] on Win 10 x64, quite
successfully till this issue came up. The noticed error so far
comes when an ImGui function returns an ImVec2, a simple POD
struct of two float members. I can use this struct
On Sunday, 21 May 2017 at 19:58:32 UTC, Stefan Koch wrote:
On Sunday, 21 May 2017 at 19:33:06 UTC, ParticlePeter wrote:
I am statically linking to ImGui [1] on Win 10 x64, quite
successfully till this issue came up. The noticed error so far
comes when an ImGui function returns an ImVec2, a
To me this seems like a bug.
On Monday, 18 September 2017 at 20:26:05 UTC, Sasszem wrote:
I'm currently working on a project and for that I've created a
thin OO-wrapper on top of derelict-sdl. However, when I close
my app, the program terminates with a segfault. I've managed to
track down the source, and found that the
Any ideas on how someone could iterate over functions in a module
as they appear, rather than any random order, without having to
manually label them?
On Saturday, 14 October 2017 at 19:01:52 UTC, piotrklos wrote:
On Saturday, 14 October 2017 at 13:12:51 UTC, Jerry wrote:
On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
(...)
If you use generate a 32-bit binary using DMD, it generates it
in a format that the C/C++ extension
On Saturday, 14 October 2017 at 14:23:34 UTC, piotrklos wrote:
On Saturday, 14 October 2017 at 13:20:27 UTC, Jerry wrote:
On Saturday, 14 October 2017 at 10:15:53 UTC, evilrat wrote:
webfreak's NativeDebug extension to be able to click to set
breakpoint on lines(only for that).
You can
On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote:
I have windows 10, VS Code with code-d and C/C++ language
extensions. I try to debug but it doesn't work. In particular,
the debugging doesn't stop on breakpoints. It exits
immediately. I recompile with -m64 and -g. I use dub to
On Saturday, 14 October 2017 at 10:15:53 UTC, evilrat wrote:
webfreak's NativeDebug extension to be able to click to set
breakpoint on lines(only for that).
You can just use VS Code setting, put the following into your
settings.json:
"debug.allowBreakpointsEverywhere": true
On Tuesday, 3 October 2017 at 12:58:47 UTC, sighoya wrote:
On Tuesday, 3 October 2017 at 12:09:04 UTC, rikki cattermole
wrote:
On 03/10/2017 1:05 PM, sighoya wrote:
Especially, I mean something like
T foo(S,T)(T i)
{
...
}
struct Foo(T) {
T value;
}
T!S foo(S, alias
On Sunday, 27 August 2017 at 15:56:14 UTC, Saigon wrote:
Hi,
Can I have Timeout function like this one [1] in Ruby? I want
to check if a TCP service is running, and the check would
return error if timeout occurs.
Thanks a lot
[1] https://github.com/ruby/ruby/blob/trunk/lib/timeout.rb
Can
On Friday, 29 June 2018 at 20:23:47 UTC, Timoses wrote:
void handler(alias func, T)(T[] ts) {
}
Btw this is pretty much std.algorithm.each
import std.algorithm;
void main() {
auto cs = [ new C(), new C() ];
cs.each!(o => o.A());
}
On Monday, 30 July 2018 at 22:22:39 UTC, solidstate1991 wrote:
I need this to port a C++ code to D (a compression algorithm
known as LZHAM), and the easiest way to deal with it would be
that. The ADLER32 and CRC32 algorithms had to be ditched, and
while I could rewrite the former to make sense
Hello, I am trying to compile a 1 year old project of mine which
uses htmld and vibed. But I get this weird linker error which
does not make any sense to me atleast. I am using Windows 7 and
dub.
htmld 0.3.6: target for configuration "library" is up to date.
taggedalgebraic 0.10.12: target
On Monday, 21 January 2019 at 21:02:23 UTC, Steven Schveighoffer
wrote:
On 1/21/19 3:37 PM, Jerry wrote:
[...]
I had a similar problem that I fixed myself actually last dconf:
https://issues.dlang.org/show_bug.cgi?id=17968
This looks almost identical as the issue was in the generated
On Monday, 21 January 2019 at 22:31:15 UTC, H. S. Teoh wrote:
On Mon, Jan 21, 2019 at 10:19:00PM +, Jerry via
Digitalmars-d-learn wrote:
On Monday, 21 January 2019 at 21:37:22 UTC, H. S. Teoh wrote:
[...]
> Looks like a problem with stale cached object files. Try:
>
On Monday, 21 January 2019 at 21:02:23 UTC, Steven Schveighoffer
wrote:
What version of the compiler are you using? My issue was fixed
in 2.080.1, and then a followup fix in 2.081.1.
-Steve
Hello!
I am using 2.084.
Interestingly it works with LDC 1.9 (frontend 2.79) and that just
works
On Monday, 21 January 2019 at 21:37:22 UTC, H. S. Teoh wrote:
On Mon, Jan 21, 2019 at 04:02:23PM -0500, Steven Schveighoffer
via Digitalmars-d-learn wrote:
On 1/21/19 3:37 PM, Jerry wrote:
> [...]
[...]
> [...]
[...]
Looks like a problem with stale cached object files. Try:
rm
On Monday, 10 September 2018 at 09:19:52 UTC, Josphe Brigmo wrote:
Is there an emulator that can run the apks? Android emulator
does not work, I suppose, because it isn't java. Complains
about a missing classes.dex file.
I'd rather have an emulator version if possible for quicker dev.
For
On Friday, 8 February 2019 at 04:51:08 UTC, Sudhi wrote:
On Friday, 8 February 2019 at 04:30:23 UTC, Arun Chandrasekaran
wrote:
On Friday, 8 February 2019 at 04:13:39 UTC, Sudhi wrote:
[...]
Works fine for me with DMD64 D Compiler v2.083.1.
https://run.dlang.io/is/RRM8GU
My example code
On Tuesday, 10 November 2020 at 11:38:30 UTC, Vladimirs Nordholm
wrote:
Hello.
I am unsure if I am going about this the right way, and if my
question even makes sense.
In essence what I want is to have two "types" represented by a
size_t. Here is an example of what I want think I want (but
On Thursday, 24 June 2021 at 18:23:01 UTC, seany wrote:
I have seen
[this](https://forum.dlang.org/thread/akhbvvjgeaspmjntz...@forum.dlang.org).
I can't call break form parallel foreach.
Okey, Is there a way to easily call .stop() from such a case?
Here is a case to consider:
outer:
On Saturday, 15 May 2021 at 11:51:11 UTC, Adam D. Ruppe wrote:
Meh, don't listen to that nonsense, just write what works for
you. D's strength is that it adapts to different styles and
meets you where you are. Listening to dogmatic sermons about
idiomatic one true ways is throwing that
Hello, followed the guide at
https://wiki.dlang.org/Build_D_for_Android
but got stuck on figuring out what linker to use.
"../ldc_android/ldc/bin/ldc2.exe" -mtriple=armv7a--linux-andro
ideabi main.d
clang: error: invalid linker name in argument '-fuse-ld=bfd'
Error:
On Friday, 21 January 2022 at 09:52:10 UTC, Jerry wrote:
On Thursday, 20 January 2022 at 19:31:06 UTC, H. S. Teoh wrote:
T
Found ld linker as you described.
Slapped on the --linker=ld flag and now everything is working.
Thanks! :D
Or atleast that's what I thought, it links, but won't run,
On Thursday, 20 January 2022 at 19:31:06 UTC, H. S. Teoh wrote:
T
Found ld linker as you described.
Slapped on the --linker=ld flag and now everything is working.
Thanks! :D
On Thursday, 20 January 2022 at 19:31:06 UTC, H. S. Teoh wrote:
On Thu, Jan 20, 2022 at 07:10:40PM +, Jerry via
Digitalmars-d-learn wrote:
You're trying to use bfd as your linker, and I think that only
exists on the Linux version of the NDK. Maybe try looking
somewhere under
ldc_android
The reason high bits are often set is because an address layout
is actually 4 indicies into the page table and a page byte
offset. So all the way to bit 48 there is index info the cpu uses.
On Sunday, 12 May 2024 at 20:13:04 UTC, WhatMeWorry` wrote:
INFO: SDL loaded v2.30.2
INFO: SDL initialized: 0
INFO: TTF loaded: v2.0.14
Error Program exited with code -1073741819
Something hit a null pointer, time to fire up the debugger :)
70 matches
Mail list logo