Re: Creating a new type, to get strong-ish type checking and restrict usage to certain operations, using struct perhaps

2017-07-21 Thread Cecil Ward via Digitalmars-d-learn
On Friday, 21 July 2017 at 18:49:21 UTC, Cecil Ward wrote: I was think about how to create a new type that holds packed bcd values, of a choice of widths, that must fit into a uint32_t or a uint64_t (not really long multi-byte objects). I am not at all sure how to do it. I thought about using

Re: find difference between two struct instances.

2017-07-21 Thread FoxyBrown via Digitalmars-d-learn
On Saturday, 22 July 2017 at 01:04:48 UTC, Nicholas Wilson wrote: On Friday, 21 July 2017 at 23:38:51 UTC, FoxyBrown wrote: [...] use opCmp in conjunction with __traits(allMembers,T) struct Example { int a,b,c; string d,e,f; } void difference(alias func, T)(T t1, T t2)

Re: executeShell not working

2017-07-21 Thread FoxyBrown via Digitalmars-d-learn
On Saturday, 22 July 2017 at 02:31:45 UTC, FoxyBrown wrote: auto sss = "sc config \""~szSvcName~"\" start= disabled"; executeShell("sc config \""~szSvcName~"\" start= disabled"); but if I copy and paste the string in to an admin console, it works fine: sc config "W32Time" start= disabled

executeShell not working

2017-07-21 Thread FoxyBrown via Digitalmars-d-learn
auto sss = "sc config \""~szSvcName~"\" start= disabled"; executeShell("sc config \""~szSvcName~"\" start= disabled"); but if I copy and paste the string in to an admin console, it works fine: sc config "W32Time" start= disabled [SC] ChangeServiceConfig SUCCESS szSvcName is W32Time. It's

Re: How can I serialize a struct into a file in the style of C?

2017-07-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 July 2017 at 02:11:27 UTC, Mike Parker wrote: On Saturday, 22 July 2017 at 01:45:29 UTC, solidstate1991 wrote: Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many

Re: How can I serialize a struct into a file in the style of C?

2017-07-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 July 2017 at 01:45:29 UTC, solidstate1991 wrote: Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many examples of this in C, however I' struggling using the same

How can I serialize a struct into a file in the style of C?

2017-07-21 Thread solidstate1991 via Digitalmars-d-learn
Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many examples of this in C, however I' struggling using the same methods through the use of code.stdc.stdio, especially as I can't

Re: Cannot find std.datetime when linking after upgrade to 2.075.0

2017-07-21 Thread Domain via Digitalmars-d-learn
On Friday, 21 July 2017 at 19:05:00 UTC, Jonathan M Davis wrote: On Friday, July 21, 2017 15:33:45 Domain via Digitalmars-d-learn wrote: After upgrade dmd to latest 2.075.0, my project no longer build: zero.lib(core_cde_4a4f.obj) : error LNK2001: unresolved external symbol _D3std8d

Re: find difference between two struct instances.

2017-07-21 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 21 July 2017 at 23:38:51 UTC, FoxyBrown wrote: On Friday, 21 July 2017 at 22:35:20 UTC, Era Scarecrow wrote: On Friday, 21 July 2017 at 21:03:22 UTC, FoxyBrown wrote: Is there a way to easily find the differences between to struct instances? I would like to report only the

Re: find difference between two struct instances.

2017-07-21 Thread FoxyBrown via Digitalmars-d-learn
On Friday, 21 July 2017 at 22:35:20 UTC, Era Scarecrow wrote: On Friday, 21 July 2017 at 21:03:22 UTC, FoxyBrown wrote: Is there a way to easily find the differences between to struct instances? I would like to report only the differences e.g., writeln(s1 - s2); prints only what is

Re: find difference between two struct instances.

2017-07-21 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 21 July 2017 at 21:03:22 UTC, FoxyBrown wrote: Is there a way to easily find the differences between to struct instances? I would like to report only the differences e.g., writeln(s1 - s2); prints only what is different between s1 and s2. This is entirely dependent on the

find difference between two struct instances.

2017-07-21 Thread FoxyBrown via Digitalmars-d-learn
Is there a way to easily find the differences between to struct instances? I would like to report only the differences e.g., writeln(s1 - s2); prints only what is different between s1 and s2.

Re: Creating a new type, to get strong-ish type checking and restrict usage to certain operations, using struct perhaps

2017-07-21 Thread Ali Çehreli via Digitalmars-d-learn
On 07/21/2017 11:49 AM, Cecil Ward wrote: I was think about how to create a new type that holds packed bcd values, of a choice of widths, that must fit into a uint32_t or a uint64_t (not really long multi-byte objects). I am not at all sure how to do it. I thought about using a templated struct

Re: Creating a new type, to get strong-ish type checking and restrict usage to certain operations, using struct perhaps

2017-07-21 Thread Moritz Maxeiner via Digitalmars-d-learn
On Friday, 21 July 2017 at 18:49:21 UTC, Cecil Ward wrote: I was think about how to create a new type that holds packed bcd values, of a choice of widths, that must fit into a uint32_t or a uint64_t (not really long multi-byte objects). I am not at all sure how to do it. I thought about using

Re: Cannot find std.datetime when linking after upgrade to 2.075.0

2017-07-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, July 21, 2017 15:33:45 Domain via Digitalmars-d-learn wrote: > After upgrade dmd to latest 2.075.0, my project no longer build: > > zero.lib(core_cde_4a4f.obj) : error LNK2001: unresolved external > symbol _D3std8d > atetime9LocalTime6opCallFNaNbNeZyC3std8datetime9LocalTime > > and many

Creating a new type, to get strong-ish type checking and restrict usage to certain operations, using struct perhaps

2017-07-21 Thread Cecil Ward via Digitalmars-d-learn
I was think about how to create a new type that holds packed bcd values, of a choice of widths, that must fit into a uint32_t or a uint64_t (not really long multi-byte objects). I am not at all sure how to do it. I thought about using a templated struct to simply wrap a uint of a chosen width,

Re: Cannot find std.datetime when linking after upgrade to 2.075.0

2017-07-21 Thread zabruk70 via Digitalmars-d-learn
https://dlang.org/changelog/2.075.0.html#split-std-datetime

Cannot find std.datetime when linking after upgrade to 2.075.0

2017-07-21 Thread Domain via Digitalmars-d-learn
After upgrade dmd to latest 2.075.0, my project no longer build: zero.lib(core_cde_4a4f.obj) : error LNK2001: unresolved external symbol _D3std8d atetime9LocalTime6opCallFNaNbNeZyC3std8datetime9LocalTime and many more. All about std.datetime.

Re: Check whether string value represents a type

2017-07-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/21/17 10:21 AM, Timoses wrote: I'd love to check whether a string value is the name of a type at run-time. E.g.: string a = "int"; string b = "im no type"; assert( isStringType(a) ); assert( !isStringType(b) ); or struct TestStruct { int test; } string t = "TestStruct"; assert(

Check whether string value represents a type

2017-07-21 Thread Timoses via Digitalmars-d-learn
I'd love to check whether a string value is the name of a type at run-time. E.g.: string a = "int"; string b = "im no type"; assert( isStringType(a) ); assert( !isStringType(b) ); or struct TestStruct { int test; } string t = "TestStruct"; assert( isStringType(t) ); Is anything like

Re: How to replace pairs tags with regexp

2017-07-21 Thread Antonio Corbi via Digitalmars-d-learn
On Friday, 21 July 2017 at 07:42:28 UTC, Suliman wrote: On Friday, 21 July 2017 at 07:30:07 UTC, Antonio Corbi wrote: On Friday, 21 July 2017 at 07:08:34 UTC, Suliman wrote: On Friday, 21 July 2017 at 06:19:43 UTC, Suliman wrote: There reason of issue above is spaces before "#". What wrong

Re: How to replace pairs tags with regexp

2017-07-21 Thread Suliman via Digitalmars-d-learn
On Friday, 21 July 2017 at 07:30:07 UTC, Antonio Corbi wrote: On Friday, 21 July 2017 at 07:08:34 UTC, Suliman wrote: On Friday, 21 July 2017 at 06:19:43 UTC, Suliman wrote: There reason of issue above is spaces before "#". What wrong with next regex https://dpaste.dzfl.pl/024a47ed2a56 I

Re: How to replace pairs tags with regexp

2017-07-21 Thread Antonio Corbi via Digitalmars-d-learn
On Friday, 21 July 2017 at 07:08:34 UTC, Suliman wrote: On Friday, 21 July 2017 at 06:19:43 UTC, Suliman wrote: There reason of issue above is spaces before "#". What wrong with next regex https://dpaste.dzfl.pl/024a47ed2a56 I expect that it will select: #Header my header text ##SubHeader

Re: How to replace pairs tags with regexp

2017-07-21 Thread Suliman via Digitalmars-d-learn
On Friday, 21 July 2017 at 06:19:43 UTC, Suliman wrote: There reason of issue above is spaces before "#". What wrong with next regex https://dpaste.dzfl.pl/024a47ed2a56 I expect that it will select: #Header my header text ##SubHeader my sub header text Because: ^#{3}

Re: How to replace pairs tags with regexp

2017-07-21 Thread Suliman via Digitalmars-d-learn
There reason of issue above is spaces before "#".