Re: Allocating byte aligned array

2017-09-27 Thread timvol via Digitalmars-d-learn
On Wednesday, 27 September 2017 at 21:44:48 UTC, Ali Çehreli wrote: On 09/27/2017 02:39 PM, timvol wrote: [...] void main() { auto mem = new ubyte[1024+15]; auto ptr = cast(ubyte*)(cast(ulong)(mem.ptr + 15) & ~0x0FUL); auto arr = ptr[0..1024]; } Ali Works perfect. Thank you!

Allocating byte aligned array

2017-09-27 Thread timvol via Digitalmars-d-learn
Hi guys, how can I allocate an (e.g. 16) byte aligned array? In C I can do the following: void *mem = malloc(1024+15); void *ptr = ((uintptr_t)mem+15) & ~ (uintptr_t)0x0F; memset_16aligned(ptr, 0, 1024); free(mem); I think in D it looks similar to this: auto mem = new

spawnProcess: Exit parent process without terminating child process

2017-08-25 Thread timvol via Digitalmars-d-learn
Hi guys, I want execute a process. I know, I can execute a process using "spawnProcess" or "executeShell". But I want exit the parent. My code for testing purposes is the following: int main(string[] asArgs_p) { if ( (asArgs_p.length >= 2) && asArgs_p[1].isDir() ) { while(1)

Re: Read conditional function parameters during compile time using __traits

2017-06-23 Thread timvol via Digitalmars-d-learn
On Wednesday, 21 June 2017 at 20:48:52 UTC, ag0aep6g wrote: On 06/21/2017 09:39 PM, timvol wrote: size_t calcLength(ubyte ubFuncCode)() if ( ubFuncCode == 1 ) { return 10; // More complex calculated value } size_t calcLength(ubyte ubFuncCode)() if ( ubFuncCode ==

Read conditional function parameters during compile time using __traits

2017-06-21 Thread timvol via Digitalmars-d-learn
Hi! I've a simple array of bytes I received using sockets. What I want to do is to calculate the target length of the message. So, I defined a calcLength() function for each function code (it's the first byte in my array). My problem is that I defined the calcLength() function using conditions

Re: cmake-d and gdc/gdmd compiler

2017-04-14 Thread timvol via Digitalmars-d-learn
On Tuesday, 4 April 2017 at 19:59:19 UTC, Dragos Carp wrote: On Tuesday, 4 April 2017 at 18:42:45 UTC, timvol wrote: Hi guys, I'm trying to cross-compile a project using CMake and gdc (or better: the gdmd port). My CMakeLists-file is the following: For cross-compiling, CMake uses a so

Re: cmake-d and gdc/gdmd compiler

2017-04-05 Thread timvol via Digitalmars-d-learn
On Tuesday, 4 April 2017 at 19:59:19 UTC, Dragos Carp wrote: On Tuesday, 4 April 2017 at 18:42:45 UTC, timvol wrote: Hi guys, I'm trying to cross-compile a project using CMake and gdc (or better: the gdmd port). My CMakeLists-file is the following: For cross-compiling, CMake uses a so

cmake-d and gdc/gdmd compiler

2017-04-04 Thread timvol via Digitalmars-d-learn
Hi guys, I'm trying to cross-compile a project using CMake and gdc (or better: the gdmd port). My CMakeLists-file is the following: cmake_minimum_required(VERSION 2.8.1) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake-d") SET(CMAKE_SYSTEM_NAME Linux) project(myapp D)