On Thursday, 5 March 2015 at 20:32:20 UTC, anonymous wrote:
That's not really simpler, though.
Maybe, but I think the union is a bit nicer because then the
compiler is responsible for more of the details. For example, it
should work with class objects without the complication of
dealing
On Thursday, 5 March 2015 at 20:03:09 UTC, Benjamin Thaut wrote:
int someValue = 5;
float sameBinary = *(cast(float*)cast(void*)someValue);
The cast(void*) isn't necessary.
On Thursday, 5 March 2015 at 19:51:09 UTC, Max Klyga wrote:
If you really need the actual pointer to object data you can
use `*cast(void**)myObject`. Compiler cannot cast object
reference to `void*` but we can trick it ;)
It can, actually. A class can define its own cast(void*) though,
so
Hi,
I'm a developer coming from C and I've a question about class
instance as method or function parameter.
In the book The D Programming Language, I read the instance was
passed by reference to functions (in the opposite of structures).
I understood that it was the same object in the
On Thursday, 5 March 2015 at 20:03:09 UTC, Benjamin Thaut wrote:
Am 05.03.2015 um 21:00 schrieb Taylor Hillegeist:
How to I cast a Int to float without changing its binary
representation?
int someValue = 5;
float sameBinary = *(cast(float*)cast(void*)someValue);
ahh of course! lol :)
On Thursday, 5 March 2015 at 20:16:55 UTC, anonymous wrote:
On Thursday, 5 March 2015 at 20:03:09 UTC, Benjamin Thaut wrote:
int someValue = 5;
float sameBinary = *(cast(float*)cast(void*)someValue);
The cast(void*) isn't necessary.
Actually even the cast is unecessary, just use a uniform.
On 2015-03-05 19:35:34 +, Chris Sperandio said:
Hi,
I'm a developer coming from C and I've a question about class instance
as method or function parameter.
In the book The D Programming Language, I read the instance was
passed by reference to functions (in the opposite of structures). I
Ok... So, in D when I work with Object, it's like if I work with
only pointers.
Thus, I can return null from a function which returns an Item
instance.
Is it clean to write this code below ?
static Item nullReturn(Item item)
{
// ...
// and for some cases
return null;
}
On Thursday, 5 March 2015 at 20:08:08 UTC, Chris Sperandio wrote:
Is it clean to write this code below ?
yup. Though remember all the downsides of null - if you try to
use a null object like accessing a member, the program will be
terminated.
How to I cast a Int to float without changing its binary
representation?
Am 05.03.2015 um 21:00 schrieb Taylor Hillegeist:
How to I cast a Int to float without changing its binary representation?
int someValue = 5;
float sameBinary = *(cast(float*)cast(void*)someValue);
Below the code:
module item;
import std.stdio;
class Item
{
ulong count;
static void call1(Item item)
{
writeln((call1) Addr: , item);
}
static void call2(ref Item item)
{
writeln((call2) Addr: , item);
}
static Item call3(Item item)
{
writeln((call3) Addr: ,
On Thursday, March 05, 2015 19:35:34 Chris Sperandio via Digitalmars-d-learn
wrote:
Hi,
I'm a developer coming from C and I've a question about class
instance as method or function parameter.
In the book The D Programming Language, I read the instance was
passed by reference to functions
On Thursday, 5 March 2015 at 20:21:18 UTC, badlink wrote:
On Thursday, 5 March 2015 at 20:16:55 UTC, anonymous wrote:
On Thursday, 5 March 2015 at 20:03:09 UTC, Benjamin Thaut
wrote:
int someValue = 5;
float sameBinary = *(cast(float*)cast(void*)someValue);
The cast(void*) isn't necessary.
On Thursday, 5 March 2015 at 20:06:55 UTC, Taylor Hillegeist
wrote:
On Thursday, 5 March 2015 at 20:03:09 UTC, Benjamin Thaut wrote:
Am 05.03.2015 um 21:00 schrieb Taylor Hillegeist:
How to I cast a Int to float without changing its binary
representation?
int someValue = 5;
float sameBinary
Seems barely maintained and there was a proposed replacement
claiming it was broken(http://wiki.dlang.org/Review/std.signal)
that never got approved.
Is std.signals worth using over a dub package?
On Thu, 05 Mar 2015 16:36:35 +0100, FG wrote:
Damn those composite characters!
or invisible ones. or RTL switch.
unicode sux[1].
[1] http://file.bestmx.net/ee/articles/uni_vs_code.pdf
signature.asc
Description: PGP signature
On Thursday, 5 March 2015 at 23:50:28 UTC, Jesse Phillips wrote:
I think I read somewhere you don't want to use unions like
this, but I think it is more because you generally don't want
to reinterpret bits.
It is non-portable, since some hardware architectures may use
different
On Thursday, 5 March 2015 at 07:38:35 UTC, ketmar wrote:
On Thu, 05 Mar 2015 06:05:55 +, zhmt wrote:
But I am not familiar with dlang
this is the root of the problem. please, make yourself familiar
before
starting to wrap boost crap.
Unwarranted tone imo. Let's play nice.
On 03/05/2015 03:25 PM, ketmar wrote:
unicode sux[1].
[1] http://file.bestmx.net/ee/articles/uni_vs_code.pdf
Thanks. I enjoyed the article and I agree with everything said in there.
It made me happy that I was not the only person who has been ruminating
over alphabet as the crucial piece
I wrote a custom OBJ file importer which worked fairly well
however was not robust enough to support everything. I've decided
to give AssImp a shot. I followed some tutorials and have set up
my code to read in the vertices, tex coords, normals, and indices
of an OBJ cube model that I have had
On Thursday, 5 March 2015 at 06:05:56 UTC, zhmt wrote:
I am a gameserver developer, my programming lang is java now.
I want to change java to dlang, and I like boost_asio and it's
coroutine,
so, I want to create a binding of boost_asio.
But I am not familiar with dlang, so I want to find
On 2015-03-05 at 10:42, Kagamin wrote:
string s;
char[] b = cast(char[])asArray();
b[0..s.length] = s[];
It's a bit more complicated than that if you include cutting string for buffers
with smaller capacity, doing so respecting UTF-8, and adding a '\0' sentinel,
since you may want to use the
On Thu, 05 Mar 2015 07:46:04 +, zhmt wrote:
I have studied for half a year, so I want to learn it in work,
in solving problems.
that's a good way to learn. but starting from writing wrappers for
something is not a good way. ;-)
if you want a wrapper for something, it's always better to
string s;
char[] b = cast(char[])asArray();
b[0..s.length] = s[];
On Thursday, 5 March 2015 at 08:22:33 UTC, Jack Applegame wrote:
On Thursday, 5 March 2015 at 06:05:56 UTC, zhmt wrote:
I am a gameserver developer, my programming lang is java now.
I want to change java to dlang, and I like boost_asio and it's
coroutine,
so, I want to create a binding of
On Thursday, 5 March 2015 at 09:42:53 UTC, Kagamin wrote:
string s;
char[] b = cast(char[])asArray();
b[0..s.length] = s[];
Thank you very much. I should stop my developing , and read the
dlang tutorial again.
On Thursday, 5 March 2015 at 09:38:27 UTC, zhmt wrote:
On Thursday, 5 March 2015 at 08:22:33 UTC, Jack Applegame wrote:
On Thursday, 5 March 2015 at 06:05:56 UTC, zhmt wrote:
I am a gameserver developer, my programming lang is java now.
I want to change java to dlang, and I like boost_asio
Thanks for all the suggestions and pointing the right direction,I
will learn and try vibe.d, try to use it in my gameserver.
29 matches
Mail list logo