Re: I want to introduce boost_asio to dlang

2015-03-05 Thread Messenger via Digitalmars-d-learn
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.

Derelict Assimp not loading mesh properly? (Maybe index buffer)

2015-03-05 Thread Bennet via Digitalmars-d-learn
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 s

Re: I want to introduce boost_asio to dlang

2015-03-05 Thread zhmt via Digitalmars-d-learn
Thanks for all the suggestions and pointing the right direction,I will learn and try vibe.d, try to use it in my gameserver.

Re: Int to float?

2015-03-05 Thread via Digitalmars-d-learn
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 representation

Re: how to write a string to a c pointer?

2015-03-05 Thread Ali Çehreli via Digitalmars-d-learn
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

Re: Int to float?

2015-03-05 Thread Jesse Phillips via Digitalmars-d-learn
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 =

Re: how to write a string to a c pointer?

2015-03-05 Thread ketmar via Digitalmars-d-learn
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

Is std.signals deprecated?

2015-03-05 Thread weaselcat via Digitalmars-d-learn
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?

Re: Int to float?

2015-03-05 Thread Adam D. Ruppe via Digitalmars-d-learn
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 with

Re: Int to float?

2015-03-05 Thread anonymous via Digitalmars-d-learn
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.

Re: Object as function argument

2015-03-05 Thread anonymous via Digitalmars-d-learn
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 th

Re: Int to float?

2015-03-05 Thread badlink via Digitalmars-d-learn
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.

Re: Int to float?

2015-03-05 Thread anonymous via Digitalmars-d-learn
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.

Re: Object as function argument

2015-03-05 Thread Adam D. Ruppe via Digitalmars-d-learn
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.

Re: Object as function argument

2015-03-05 Thread Chris Sperandio via Digitalmars-d-learn
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; }

Re: Int to float?

2015-03-05 Thread Taylor Hillegeist via Digitalmars-d-learn
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 :)

Int to float?

2015-03-05 Thread Taylor Hillegeist via Digitalmars-d-learn
How to I cast a Int to float without changing its binary representation?

Re: Int to float?

2015-03-05 Thread Benjamin Thaut via Digitalmars-d-learn
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);

Re: Object as function argument

2015-03-05 Thread Jonathan M Davis via Digitalmars-d-learn
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 funct

Re: Object as function argument

2015-03-05 Thread Chris Sperandio via Digitalmars-d-learn
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) Add

Re: Object as function argument

2015-03-05 Thread Max Klyga via Digitalmars-d-learn
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

Re: Object as function argument

2015-03-05 Thread w0rp via Digitalmars-d-learn
On Thursday, 5 March 2015 at 19:35:35 UTC, Chris Sperandio 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 (in the opposite of

Object as function argument

2015-03-05 Thread Chris Sperandio via Digitalmars-d-learn
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 functi

Re: Getting the socket information from HTTP and DNS sessions

2015-03-05 Thread Ali Çehreli via Digitalmars-d-learn
On 03/04/2015 11:46 PM, Kadir Erdem Demir wrote: I have been ask to write a test tool which initiates DNS-HTTP-HTTPS-TCP sessions. And ofcourse I wrote this with D. For HTTP I used std.net like "m_HTTP = HTTP(m_url);m_HTTP.perform();" For DNS I simply used "getAddressInfo(m_domainName);" Than

Re: how to write a string to a c pointer?

2015-03-05 Thread FG via Digitalmars-d-learn
On 2015-03-05 at 15:18, Kagamin wrote: On Thursday, 5 March 2015 at 13:57:45 UTC, FG wrote: void main() { string s = "ąćęłńóśźż"; Try with string s = "ąc\u0301ęłńóśźż"; Yeah, I see your point: ą, ąc (missing diacritic), ąć, ąćę, ... Damn those composite characters!

Re: how to write a string to a c pointer?

2015-03-05 Thread Kagamin via Digitalmars-d-learn
On Thursday, 5 March 2015 at 13:57:45 UTC, FG wrote: void main() { string s = "ąćęłńóśźż"; Try with string s = "ąc\u0301ęłńóśźż";

Re: how to write a string to a c pointer?

2015-03-05 Thread FG via Digitalmars-d-learn
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

Re: I want to introduce boost_asio to dlang

2015-03-05 Thread Atila Neves via Digitalmars-d-learn
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 and

Re: I want to introduce boost_asio to dlang

2015-03-05 Thread ketmar via Digitalmars-d-learn
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

Re: I want to introduce boost_asio to dlang

2015-03-05 Thread ketmar via Digitalmars-d-learn
On Thu, 05 Mar 2015 09:38:25 +, zhmt wrote: >> There is no need to do it. Just use http://vibed.org/ instead of >> boost::asio. > It sounds like a good choice, is it as good as boost::asio? no. it's alot better. signature.asc Description: PGP signature

Re: how to write a string to a c pointer?

2015-03-05 Thread zhmt via Digitalmars-d-learn
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.

Re: how to write a string to a c pointer?

2015-03-05 Thread Kagamin via Digitalmars-d-learn
string s; char[] b = cast(char[])asArray(); b[0..s.length] = s[];

Re: I want to introduce boost_asio to dlang

2015-03-05 Thread zhmt via Digitalmars-d-learn
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 boo

Re: I want to introduce boost_asio to dlang

2015-03-05 Thread Jack Applegame via Digitalmars-d-learn
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 some