On 11/19/2013 11:18 PM, Jeremy DeHaan wrote:
Like I said in the title, this is related to Windows. Basically, I'm
looking to put a command line together to keep things consistent between
Windows, OSX and Linux.
On OSX and Linux I would do -L-lLibraryName, but is there something
similar that one
Like I said in the title, this is related to Windows. Basically,
I'm looking to put a command line together to keep things
consistent between Windows, OSX and Linux.
On OSX and Linux I would do -L-lLibraryName, but is there
something similar that one can do on Windows? Or do I have to add
Lib
On Tuesday, 19 November 2013 at 19:31:41 UTC, bearophile wrote:
The clean design is to use std.typecons.Nullable:
Nullable!(string[]) func(string[] zz) {
I have found that Nullable is pretty much useless for this type
of usage, because it aliases itself to the underlying value, and
then any
On Wednesday, 20 November 2013 at 02:14:29 UTC, Carlos wrote:
But I want to declare this functions "print" outside of the
file and call the file to be loaded by the compiler. So I can
use the same solution in various program without having to copy
paste it to each one.
first way - put this "p
I just readhow to do it down on the list of tuts.
I did : dmd primes.d ./prime.d, and done program ran perfectly
So I'm reading this tut from Ali :)
And we I got to this part :
A code example. http://pastebin.com/ESeL7dfH
But I want to declare this functions "print" outside of the file
and call the file to be loaded by the compiler. So I can use the
same solution in various program without having to cop
On 11/20/2013 5:59 AM, Dale Matthews wrote:
class Vec3
{
bool opEquals()(auto ref const Vec3 v) const
You don't need to use 'ref' on parameters that are classes. Unlike C++,
D classes are already reference types, not value types. More like Java.
Structs, OTOH, are value types. With t
On Tuesday, 19 November 2013 at 23:34:48 UTC, Ali Çehreli wrote:
On 11/19/2013 03:16 PM, Carlos wrote:> Well in C I just
declared an array during execution with an array with a
> multiplied variable for the size of the array.
>
> Since I only need two spaces in the array for each line of
process
works as expected
import std.traits : isSomeChar;
import std.range: ElementEncodingType;
import std.stdio;
@safe pure nothrow
template CharEncodingType(Char)
{
alias ET = ElementEncodingType!Char;
static if (is (ET == char)) {
alias CharEncodingType = ubyte;
} else st
On Tuesday, 19 November 2013 at 12:53:50 UTC, bearophile wrote:
Craig Dillabaugh:
// Assume images are of the same dimensions. Result is
// saved in Out.
void add(T,U,V)(Image!T A, Image!U B, Image!V Out) {
...
}
Take a look at the "out" annotation in D.
Anyway, thanks to whoever ta
I try this
import std.traits : isSomeChar;
import std.typetuple: TypeTuple;
import std.stdio;
template CharEncodingType(Char)
{
// Get representation type
alias TypeTuple!(ubyte, ushort, uint) U;
// const and immutable storage classes
static if (is(Char == immutabl
Ali Çehreli:
That is a VLA.
That are currently not present in D. The most common and safe
alternatives in D are allocating the memory on the heap with
'new', or over-allocating on the stack a fixed size and then
slicing.
If the OP really wants to allocate on the stack, there is the
allo
On Tuesday, 19 November 2013 at 23:58:20 UTC, Andrea Fontana
wrote:
And, of course, struct are value type, class are reference type.
Yeah, true in general, though it is possible to have a struct be
very similar to a reference type. Consider:
struct WrappedClass {
Object obj;
/* and wha
On Tuesday, 19 November 2013 at 21:33:31 UTC, Adam D. Ruppe wrote:
On Tuesday, 19 November 2013 at 21:25:47 UTC, Dale Matthews
wrote:
Adam, do you recommend using a struct instead of a class?
Yes, I would use a struct instead of a class here. The key
question to ask in D is: do you need inher
On Tuesday, 19 November 2013 at 23:53:33 UTC, bioinfornatics
wrote:
On Tuesday, 19 November 2013 at 06:11:26 UTC, Ali Çehreli wrote:
On 11/18/2013 07:48 PM, bioinfornatics wrote:
On Thursday, 14 November 2013 at 12:01:04 UTC, Ali Çehreli
wrote:
On 11/13/2013 04:32 PM, bioinfornatics wrote:
Hi
On Tuesday, 19 November 2013 at 06:11:26 UTC, Ali Çehreli wrote:
On 11/18/2013 07:48 PM, bioinfornatics wrote:
On Thursday, 14 November 2013 at 12:01:04 UTC, Ali Çehreli
wrote:
On 11/13/2013 04:32 PM, bioinfornatics wrote:
Hi,
I try to understand which type char, dchar, wchar will give
ubyte,u
On Tuesday, 19 November 2013 at 18:35:08 UTC, Jeroen Bollen wrote:
Is there a way I can call a receive method on a socket with
MSG_WAITALL as a flag? There doesn't seem to be an enum for
that.
module core.sys.posix.sys.socket;
enum : uint
{
MSG_CTRUNC = 0x08,
MSG_
On 11/19/2013 03:16 PM, Carlos wrote:> Well in C I just declared an
array during execution with an array with a
> multiplied variable for the size of the array.
>
> Since I only need two spaces in the array for each line of process it
> was multiplied by two.
>
> so it was like this :
>
> scanf("
Well in C I just declared an array during execution with an array
with a multiplied variable for the size of the array.
Since I only need two spaces in the array for each line of
process it was multiplied by two.
so it was like this :
scanf("%d", &Num);
int array[Num*2];
When I tried to do
On 11/19/2013 02:42 PM, "Nordlöw" wrote:
On Tuesday, 19 November 2013 at 21:14:01 UTC, Brad Anderson wrote:
On Tuesday, 19 November 2013 at 21:11:42 UTC, Nordlöw wrote:
If I have a hash-table `File[string] _subs` and want to access its
values in a sorted way is there a better than simply throug
On Tuesday, 19 November 2013 at 21:14:01 UTC, Brad Anderson wrote:
On Tuesday, 19 November 2013 at 21:11:42 UTC, Nordlöw wrote:
If I have a hash-table `File[string] _subs` and want to access
its values in a sorted way is there a better than simply
through
auto ssubs = new File[_subs.lengt
On Tuesday, 19 November 2013 at 22:42:10 UTC, Nordlöw wrote:
On Tuesday, 19 November 2013 at 21:14:01 UTC, Brad Anderson
wrote:
On Tuesday, 19 November 2013 at 21:11:42 UTC, Nordlöw wrote:
If I have a hash-table `File[string] _subs` and want to
access its values in a sorted way is there a bette
is there any particular reason you are forced to use SOAP?
It is more or less an obsolete and generally frowned upon
approach.
if you were willing to adopt REST, vibe.d seems to have some nice
functionality for creating REST APIs.
Look at the 'Routing' section here:
http://vibed.org/docs#h
On Tuesday, 19 November 2013 at 21:25:47 UTC, Dale Matthews wrote:
Adam, do you recommend using a struct instead of a class?
Yes, I would use a struct instead of a class here. The key
question to ask in D is: do you need inheritance? If yes, use a
class, if no, struct is usually better, since
On Tuesday, 19 November 2013 at 21:22:27 UTC, Adam D. Ruppe wrote:
IGNORE ME, I am wrong here. I mixed up opEquals and opAssign in
my head.
Sorry!
Will do :]
On Tuesday, 19 November 2013 at 21:10:57 UTC, Chris
Nicholson-Sauls wrote:
override bool opEquals (Object o) const {
if ( auto v = cast( typeof( this ) ) o )
return x == v.x && y == v.y && z == v.z;
return false;
}
You need:
1) 'override' in order to override
Dicebot:
I don't want to argue this in details right now but I think
that simply banning null references as valid arrays in program
as a whole via contracts is better approach than adding extra
level of indirection via Nullable ;)
Nullable is a struct, it doesn't introduce a new leavel of
i
This was a bug and has since been fixed, so the solution is
simply to update your compiler. If there is some reason you
can't (company required version, etc) then your cast() is sadly
probably the only way.
On Tuesday, 19 November 2013 at 21:05:23 UTC, Adam D. Ruppe wrote:
opEquals doesn't work on classes with class references.
IGNORE ME, I am wrong here. I mixed up opEquals and opAssign in
my head.
Sorry!
On Tuesday, 19 November 2013 at 21:11:42 UTC, Nordlöw wrote:
If I have a hash-table `File[string] _subs` and want to access
its values in a sorted way is there a better than simply through
auto ssubs = new File[_subs.length]; // preallocate sorted
subs
size_t ix = 0;
foreach (sub
If I have a hash-table `File[string] _subs` and want to access
its values in a sorted way is there a better than simply through
auto ssubs = new File[_subs.length]; // preallocate sorted
subs
size_t ix = 0;
foreach (sub; _subs) {
ssubs[ix++] = sub; // set new reference to
On Tuesday, 19 November 2013 at 20:59:31 UTC, Dale Matthews wrote:
I'm brand new to D and I'm taking on a project. In the midst,
I've overloaded a whole load of operators for my Vec3 class.
Most seem to be working (I haven't tested them all yet) but
opEquals is refusing to be called. I've follo
On Tuesday, 19 November 2013 at 19:15:10 UTC, seany wrote:
(so i want liek a C style fopen -like function, that , although
called with the syntax: file *f = fopen(balh, "bla"); can set f
to be false)
I think you have a misunderstanding here. C does not allow you to
return "false." Instead C s
On Tuesday, 19 November 2013 at 20:59:31 UTC, Dale Matthews wrote:
I feel like I'm missing something simple.
opEquals doesn't work on classes with class references. It
doesn't call a method with obj = other_obj, it just rebinds the
reference. If you want full control over opEquals, it'll have
I'm brand new to D and I'm taking on a project. In the midst,
I've overloaded a whole load of operators for my Vec3 class. Most
seem to be working (I haven't tested them all yet) but opEquals
is refusing to be called. I've followed the guidelines here:
http://dlang.org/operatoroverloading.html#
On Tuesday, 19 November 2013 at 20:38:00 UTC, Adam D. Ruppe wrote:
On Monday, 18 November 2013 at 23:49:56 UTC, Rick Catano wrote:
My first question of the D language is, is there a SOAP module
that I can consume web services with?
I don't know, but I don't think so. Maybe it wouldn't be too
On Monday, 18 November 2013 at 23:49:56 UTC, Rick Catano wrote:
My first question of the D language is, is there a SOAP module
that I can consume web services with?
I don't know, but I don't think so. Maybe it wouldn't be too hard
to make out by combining http get (with curl or whatever) with
Anyone? I know it's a very basic question, but an honest and
friendly answer will suffice.
On Tuesday, 19 November 2013 at 19:31:41 UTC, bearophile wrote:
A Nullable in usually efficient enough (there is even an
alternative Nullable that doesn't increase the data size), it
makes typing stronger, and it should become more common in
system languages (and indeed it's commonly used in Ru
seany:
I have a function FUNC, it takes a string array, and does
something with it, and retruns the same. Implemented based on a
previous thread, here is what i have
string[] FUNC (ref string[] ZZ)
I told you to use ref if you want to modify in-place the length
of the array, as in the exap
On 11/19/2013 11:15 AM, seany wrote:
> Consider this:
>
> I have a function FUNC, it takes a string array, and does something with
> it, and retruns the same. Implemented based on a previous thread, here
> is what i have
>
> string[] FUNC (ref string[] ZZ)
> {
> /*
> do something
> */
> }
>
> and
On Tuesday, 19 November 2013 at 19:15:10 UTC, seany wrote:
Now, I want, should the function be not successful in doing
what it intends to do, to return a boolean value of false, to
ZZ, un fortunately ZZ is already a string[] (so i want liek a C
style fopen -like function, that , although called
On Tuesday, 19 November 2013 at 19:15:10 UTC, seany wrote:
Consider this:
I have a function FUNC, it takes a string array, and does
something with it, and retruns the same. Implemented based on a
previous thread, here is what i have
string[] FUNC (ref string[] ZZ)
{
/*
do something
*/
}
and
Consider this:
I have a function FUNC, it takes a string array, and does
something with it, and retruns the same. Implemented based on a
previous thread, here is what i have
string[] FUNC (ref string[] ZZ)
{
/*
do something
*/
}
and the calling is, ZZ = FUNC(ZZ)
Now, I want, should the func
Uh I forgot to mention that it should do this without global
variables, and without try / catch
Is there a way I can call a receive method on a socket with
MSG_WAITALL as a flag? There doesn't seem to be an enum for that.
On Tuesday, 19 November 2013 at 18:09:29 UTC, Namespace wrote:
On Tuesday, 19 November 2013 at 18:01:19 UTC, Jeroen Bollen
wrote:
If I have a function:
@safe pure void functionName() {
return;
}
Where do I put the noexcept?
Did you mean nothrow?
You can put it u
On Tuesday, 19 November 2013 at 18:01:19 UTC, Jeroen Bollen wrote:
If I have a function:
@safe pure void functionName() {
return;
}
Where do I put the noexcept?
Did you mean nothrow?
You can put it unfortunately on both sides.
left:
@safe pure nothrow void funct
If I have a function:
@safe pure void functionName() {
return;
}
Where do I put the noexcept?
You'd usually find stuff like this (i.e. generic algorithms that act on
collections) in std.algorithms
http://dlang.org/phobos/std_algorithm.html#equal
On Tue, Nov 19, 2013 at 3:12 PM, seany wrote:
> Is there a built in function or operator in D that can compare two arrays
> (prefereably any d
Adam D. Ruppe:
a == b works on single dimension. Not sure about beyond that
though.
It works on nD arrays:
void main() {
immutable m1 = [[1, 2], [3, 4]];
immutable m2 = [[1, 2], [3, 4]];
immutable m3 = [[1, 2], [3, 5]];
assert(m1 == m2);
assert(m1 != m3);
assert(m1 < m
seany:
Say I defined an array as int[] a = [1,2,3,4];
Now if I do a = function(a);
will that make a to equal [1,2,3,4,5]
the function is defined as:
int[] function(int[] b)
{ return b ~ 5;}
D dynamic arrays are partially values, so use:
int[] function(ref int[] b)
Bye,
bearophile
On Tuesday, 19 November 2013 at 14:12:14 UTC, seany wrote:
Is there a built in function or operator in D that can compare
two arrays (prefereably any dimensional) for being elementwise
equal?
a == b works on single dimension. Not sure about beyond that
though.
Say I defined an array as int[] a = [1,2,3,4];
Now if I do a = function(a);
will that make a to equal [1,2,3,4,5]
the function is defined as:
int[] function(int[] b)
{ return b ~ 5;}
Is there a built in function or operator in D that can compare
two arrays (prefereably any dimensional) for being elementwise
equal?
thnak you
Craig Dillabaugh:
// Assume images are of the same dimensions. Result is
// saved in Out.
void add(T,U,V)(Image!T A, Image!U B, Image!V Out) {
...
}
Take a look at the "out" annotation in D.
Anyway, thanks to whoever takes the time to read all that, let
alone come up with an answer.
this question came up in some C++ work I am doing, but since the
solutions are likely nicer in D, I wanted to ask how it could be
solved in D.
First for some motivation. I am doing image processing work
where the images are simply an array of data, where the data type
can be any numeric type. Th
On Monday, 18 November 2013 at 20:32:25 UTC, Philippe Sigaud
wrote:
On Mon, Nov 18, 2013 at 9:20 PM, seany
wrote:
I read that book, but dont find this constructtion, that is
why the
question.
IIRC I talk a bit about function templates in my tutorial. JR
gave the
link (thanks!), another, mor
On Mon, 18 Nov 2013 21:32:11 +0100, Philippe Sigaud wrote:
> On Mon, Nov 18, 2013 at 9:20 PM, seany wrote:
>> I read that book, but dont find this constructtion, that is why the
>> question.
>
> IIRC I talk a bit about function templates in my tutorial. JR gave the
> link (thanks!), another, mor
59 matches
Mail list logo