Re: Objects(from classes) at Compile time? no gc

2014-05-19 Thread Taylor Hillegeist via Digitalmars-d-learn
On Saturday, 17 May 2014 at 13:21:29 UTC, Marc Schütz wrote: On Friday, 16 May 2014 at 22:48:08 UTC, Taylor Hillegeist wrote: Although, I don't know if it will allocate it during runtime as well. It will not. -Steve Does this work in GDC? Can't test in GDC, but it does work in LDC, and I

Re: DerelictAL Symbol undefined

2014-05-19 Thread Jack via Digitalmars-d-learn
On Tuesday, 20 May 2014 at 00:43:03 UTC, Jack wrote: On Monday, 19 May 2014 at 15:15:37 UTC, Mike Parker wrote: Do you have multiple versions of DMD installed? Did you recently replace an >older version with a newer one? I think this is the main issue. I'll try to reinstall dmd2 again. The

Re: Error compiling test code

2014-05-19 Thread Rikki Cattermole via Digitalmars-d-learn
On 20/05/2014 3:17 p.m., Larry Hemsley wrote: I just installed dmd on Mint Linux distro using the Ubuntu dep package. Ran a simple test program test.d and recieved this error. test.d(1): Error: module stdio is in file 'stdio.d' which cannot be read import path[0] = /usr/include/dmd/phobos import

Error compiling test code

2014-05-19 Thread Larry Hemsley via Digitalmars-d-learn
I just installed dmd on Mint Linux distro using the Ubuntu dep package. Ran a simple test program test.d and recieved this error. test.d(1): Error: module stdio is in file 'stdio.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import Ch

Re: DerelictAL Symbol undefined

2014-05-19 Thread Jack via Digitalmars-d-learn
On Monday, 19 May 2014 at 15:15:37 UTC, Mike Parker wrote: Do you have multiple versions of DMD installed? Did you recently replace an >older version with a newer one? I think this is the main issue. I'll try to reinstall dmd2 again.

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Dicebot via Digitalmars-d-learn
On Monday, 19 May 2014 at 21:01:52 UTC, monarch_dodra wrote: Huh, will it also make possible to call `realloc` if capacity is exceeded? AFAIK, using the "GC.realloc" (or "GC.extent") function on it directly would not work. This may or may not be an issue with how "GC.realloc" is designed. The

Re: Video playback

2014-05-19 Thread ponce via Digitalmars-d-learn
On Sunday, 18 May 2014 at 07:10:29 UTC, Dmitry wrote: Hi everyone! I want to play video in my D-application (maybe WebM or Theora). However didn't find any library for operation with video in D. I am a beginner in D, experience of transfer of libraries with C/C++, certainly isn't present. May

Re: Video playback

2014-05-19 Thread alexhairyman via Digitalmars-d-learn
On Sunday, 18 May 2014 at 07:10:29 UTC, Dmitry wrote: Hi everyone! I want to play video in my D-application (maybe WebM or Theora). However didn't find any library for operation with video in D. I am a beginner in D, experience of transfer of libraries with C/C++, certainly isn't present. May

Re: Can't call isDir on linux on const object

2014-05-19 Thread Spacen via Digitalmars-d-learn
On Monday, 19 May 2014 at 20:18:40 UTC, Adam D. Ruppe wrote: On Monday, 19 May 2014 at 20:11:45 UTC, Spacen wrote: The same code works on windows DMD 1.65. But on linux: It's because of caching. isDir on Linux calls a function with this comment: /++ This is to support la

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 19 May 2014 at 18:51:31 UTC, Dicebot wrote: If it still resorts to GC in this case, utility of such addition sounds questionable. It's not really an "addition" as much as it is a "necessary building block to make higher order GC functions work": For example, "dup" was recently made

Re: Can't call isDir on linux on const object

2014-05-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 19 May 2014 at 20:11:45 UTC, Spacen wrote: The same code works on windows DMD 1.65. But on linux: It's because of caching. isDir on Linux calls a function with this comment: /++ This is to support lazy evaluation, because doing stat's is expensive

Can't call isDir on linux on const object

2014-05-19 Thread Spacen via Digitalmars-d-learn
The same code works on windows DMD 1.65. But on linux: delold.d(54): Error: mutable method std.file.DirEntry.isDir is not callable using a const object [code] bool printFile(in DirEntry dirEntry, in Duration age, Options options) { immutable string type = dirEntry.isDir ? "directory" :

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On Mon, 19 May 2014 14:46:59 -0400, monarch_dodra wrote: On Monday, 19 May 2014 at 13:55:00 UTC, Steven Schveighoffer wrote: On Monday, 19 May 2014 at 06:08:18 UTC, Ali Çehreli wrote: This issue puts std.array.array to a disadvantage compared to proper slices because array() involves the

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Dicebot via Digitalmars-d-learn
On Monday, 19 May 2014 at 13:44:45 UTC, monarch_dodra wrote: Recently, a new function in druntime was added: "_d_newarrayU". This void allocates a new array *with* appendable information. We can hope it will be given a more formal and public interface, and it would then be useable by array and

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 19 May 2014 at 13:55:00 UTC, Steven Schveighoffer wrote: On Monday, 19 May 2014 at 06:08:18 UTC, Ali Çehreli wrote: This issue puts std.array.array to a disadvantage compared to proper slices because array() involves the following call chain, the last of which does call GC.malloc:

Re: Modify char in string

2014-05-19 Thread Ali Çehreli via Digitalmars-d-learn
On 05/19/2014 10:07 AM, Tim wrote: > I already tried: > > void main() > { > char[] sMyText = "Replace the last char_"; > sMyText[$ - 1] = '.'; > } > > but I always getting "Error: cannot implicitly convert expression > ("Replace the last char_") of type string

Re: Modify char in string

2014-05-19 Thread Tim via Digitalmars-d-learn
On Sunday, 18 May 2014 at 19:09:52 UTC, Chris Cain wrote: On Sunday, 18 May 2014 at 18:55:59 UTC, Tim wrote: Hi everyone, is there any chance to modify a char in a string like: As you've seen, you cannot modify immutables (string is an immutable(char)[]). If you actually do want the string t

Re: Convert a hex string into a ubyte[] or OutBuffer

2014-05-19 Thread Darren via Digitalmars-d-learn
On Monday, 19 May 2014 at 12:28:14 UTC, anonymous wrote: On Monday, 19 May 2014 at 11:36:43 UTC, Darren wrote: Is there an idiomatic/simple way to do that? import std.conv: parse; import std.array: array; import std.range: chunks; import std.algorithm: map; ubyte[] bytes = hexnum /* "16D8...

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Ali Çehreli via Digitalmars-d-learn
On 05/19/2014 06:55 AM, Steven Schveighoffer wrote: > On Mon, 19 May 2014 09:44:44 -0400, monarch_dodra >> Recently, a new function in druntime was added: "_d_newarrayU". > Cool, I didn't know this! Thank you both! This information may be mentioned during a lightning talk at DConf. ;) Ali

Re: Write double to text file, then read it back later without losing precision

2014-05-19 Thread Andrew Brown via Digitalmars-d-learn
I'm sure it will be, thank you very much. On Monday, 19 May 2014 at 15:57:53 UTC, bearophile wrote: Andrew Brown: I would like to write a double to a text file as hexadecimal and then read it back in without losing information. Is this good enough for you? void main() { import std.stdio

Re: Write double to text file, then read it back later without losing precision

2014-05-19 Thread bearophile via Digitalmars-d-learn
Andrew Brown: I would like to write a double to a text file as hexadecimal and then read it back in without losing information. Is this good enough for you? void main() { import std.stdio, std.math; auto fout = File("ouput.txt", "w"); fout.writef("%a", PI); fout.close; a

Write double to text file, then read it back later without losing precision

2014-05-19 Thread Andrew Brown via Digitalmars-d-learn
I would like to write a double to a text file as hexadecimal and then read it back in without losing information. Could someone tell me whether this is possible? It would happen in the same program, would I have to worry about different architectures? Thanks very much Andrew

Re: DerelictAL Symbol undefined

2014-05-19 Thread Mike Parker via Digitalmars-d-learn
On 5/19/2014 10:59 PM, Jack wrote: Code: http://pastebin.com/pQjH3jRs Error code is this: Error 42: Symbol Undefined _D3std7windows8syserror14sysErrorStringFNekZAya --- errorlevel 1 I'm currently using Xamarin Studio and the compiler spewed this error out. I searched around and it said that i

DerelictAL Symbol undefined

2014-05-19 Thread Jack via Digitalmars-d-learn
Code: http://pastebin.com/pQjH3jRs Error code is this: Error 42: Symbol Undefined _D3std7windows8syserror14sysErrorStringFNekZAya --- errorlevel 1 I'm currently using Xamarin Studio and the compiler spewed this error out. I searched around and it said that it had to do with my phobos installat

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On Mon, 19 May 2014 09:44:44 -0400, monarch_dodra wrote: On Monday, 19 May 2014 at 06:08:18 UTC, Ali Çehreli wrote: We know that most of the time memory is allocated more than the requested amount. Is there a way to take advantage of that extra trailing space? (And potentially the pages t

Re: Is it possible to assumeSafeAppend malloced memory?

2014-05-19 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 19 May 2014 at 06:08:18 UTC, Ali Çehreli wrote: We know that most of the time memory is allocated more than the requested amount. Is there a way to take advantage of that extra trailing space? (And potentially the pages that come after that.) import core.memory; void main() {

Re: Convert a hex string into a ubyte[] or OutBuffer

2014-05-19 Thread anonymous via Digitalmars-d-learn
On Monday, 19 May 2014 at 11:36:43 UTC, Darren wrote: String hexnum = "16D81B16E091F31BEF"; string (lowercase) I'd like to convert it into a ubyte[] in order to Base64 encode it (or, indeed ASCII85 or Base32). eg, [16, D8, 1B, 16, E0, 91, F3, 1B, EF] Is there an idiomatic/simple way to do

Re: Convert a hex string into a ubyte[] or OutBuffer

2014-05-19 Thread bearophile via Digitalmars-d-learn
Darren: Let's say I have a hex representation of a large number: String hexnum = "16D81B16E091F31BEF"; I'd like to convert it into a ubyte[] A simple way is to use hex strings and then cast it to immutable(ubyte)[]: void main() { immutable hexNum = cast(immutable(ubyte)[])x"16D81B16E

Convert a hex string into a ubyte[] or OutBuffer

2014-05-19 Thread Darren via Digitalmars-d-learn
Hi, I'm trying to do something very basic with large numbers: Let's say I have a hex representation of a large number: String hexnum = "16D81B16E091F31BEF"; I'd like to convert it into a ubyte[] in order to Base64 encode it (or, indeed ASCII85 or Base32). eg, [16, D8, 1B, 16, E0, 91, F3, 1B

Re: Problems with dmd Switches in Makefiles

2014-05-19 Thread via Digitalmars-d-learn
On Sunday, 18 May 2014 at 16:15:53 UTC, Marc Schütz wrote: For the compiler version, I've submitted a PR: https://github.com/D-Programming-Language/dmd/pull/3558 Ok, the outcome is that a dedicated option is not seen as necessary. DMD already prints its version as the first line if you call