www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Code Reviewer

reply "Clayton" <johnsjdsd gmail.com> writes:
Hello everyone,

Am looking for someone who could help review my code . As an 
entry exercise to D am converting  3 C implementations of popular 
pattern  matching algorithms. The idea is to have 6 final 
implementations ( 3 compile-time and 3 runtime) . I think am 
basically done with the coding, but being a beginner myself, I 
feel I need some do some critics so I can improve (especially on 
the compiletime ones).

I could have uploaded direct but I think the code may be way too 
long.

Help will be dearly appreciated.
Aug 11 2015
next sibling parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On 12/08/2015 10:50 a.m., Clayton wrote:
 Hello everyone,

 Am looking for someone who could help review my code . As an entry
 exercise to D am converting  3 C implementations of popular pattern
 matching algorithms. The idea is to have 6 final implementations ( 3
 compile-time and 3 runtime) . I think am basically done with the coding,
 but being a beginner myself, I feel I need some do some critics so I can
 improve (especially on the compiletime ones).

 I could have uploaded direct but I think the code may be way too long.

 Help will be dearly appreciated.
Upload to e.g. Github/gist/pastebin.
Aug 11 2015
parent reply "Clayton" <johnsjdsd gmail.com> writes:
On Wednesday, 12 August 2015 at 02:49:59 UTC, Rikki Cattermole 
wrote:
 On 12/08/2015 10:50 a.m., Clayton wrote:
 Hello everyone,

 Am looking for someone who could help review my code . As an 
 entry
 exercise to D am converting  3 C implementations of popular 
 pattern
 matching algorithms. The idea is to have 6 final 
 implementations ( 3
 compile-time and 3 runtime) . I think am basically done with 
 the coding,
 but being a beginner myself, I feel I need some do some 
 critics so I can
 improve (especially on the compiletime ones).

 I could have uploaded direct but I think the code may be way 
 too long.

 Help will be dearly appreciated.
Upload to e.g. Github/gist/pastebin.
Hi Rikki, can I have your email so I add you to my repository on BitBucket?
Aug 12 2015
parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On 13/08/2015 12:09 a.m., Clayton wrote:
 On Wednesday, 12 August 2015 at 02:49:59 UTC, Rikki Cattermole wrote:
 On 12/08/2015 10:50 a.m., Clayton wrote:
 Hello everyone,

 Am looking for someone who could help review my code . As an entry
 exercise to D am converting  3 C implementations of popular pattern
 matching algorithms. The idea is to have 6 final implementations ( 3
 compile-time and 3 runtime) . I think am basically done with the coding,
 but being a beginner myself, I feel I need some do some critics so I can
 improve (especially on the compiletime ones).

 I could have uploaded direct but I think the code may be way too long.

 Help will be dearly appreciated.
Upload to e.g. Github/gist/pastebin.
Hi Rikki, can I have your email so I add you to my repository on BitBucket?
No need, as long as it is not propriety code feel free to post the links :) That way anybody who is willing to comment can.
Aug 12 2015
parent "Clayton" <johnsjdsd gmail.com> writes:
On Wednesday, 12 August 2015 at 12:14:20 UTC, Rikki Cattermole 
wrote:
 On 13/08/2015 12:09 a.m., Clayton wrote:
 On Wednesday, 12 August 2015 at 02:49:59 UTC, Rikki Cattermole 
 wrote:
 On 12/08/2015 10:50 a.m., Clayton wrote:
 [...]
Upload to e.g. Github/gist/pastebin.
Hi Rikki, can I have your email so I add you to my repository on BitBucket?
No need, as long as it is not propriety code feel free to post the links :) That way anybody who is willing to comment can.
Thanks , I have put the compiletime code here : http://dpaste.dzfl.pl/f0bec44f859e
Aug 13 2015
prev sibling next sibling parent reply "sigod" <sigod.mail gmail.com> writes:
On Tuesday, 11 August 2015 at 22:50:52 UTC, Clayton wrote:
 Hello everyone,

 Am looking for someone who could help review my code . As an 
 entry exercise to D am converting  3 C implementations of 
 popular pattern  matching algorithms. The idea is to have 6 
 final implementations ( 3 compile-time and 3 runtime) . I think 
 am basically done with the coding, but being a beginner myself, 
 I feel I need some do some critics so I can improve (especially 
 on the compiletime ones).

 I could have uploaded direct but I think the code may be way 
 too long.

 Help will be dearly appreciated.
Use this site: http://codereview.stackexchange.com/
Aug 12 2015
parent "Clayton" <johnsjdsd gmail.com> writes:
On Wednesday, 12 August 2015 at 13:14:04 UTC, sigod wrote:
 On Tuesday, 11 August 2015 at 22:50:52 UTC, Clayton wrote:
 Hello everyone,

 Am looking for someone who could help review my code . As an 
 entry exercise to D am converting  3 C implementations of 
 popular pattern  matching algorithms. The idea is to have 6 
 final implementations ( 3 compile-time and 3 runtime) . I 
 think am basically done with the coding, but being a beginner 
 myself, I feel I need some do some critics so I can improve 
 (especially on the compiletime ones).

 I could have uploaded direct but I think the code may be way 
 too long.

 Help will be dearly appreciated.
Use this site: http://codereview.stackexchange.com/
Thanks sigod, I have also put the compiletime code here : http://dpaste.dzfl.pl/f0bec44f859e
Aug 13 2015
prev sibling parent Rikki Cattermole <alphaglosined gmail.com> writes:
On 12/08/2015 10:50 a.m., Clayton wrote:
 Hello everyone,

 Am looking for someone who could help review my code . As an entry
 exercise to D am converting  3 C implementations of popular pattern
 matching algorithms. The idea is to have 6 final implementations ( 3
 compile-time and 3 runtime) . I think am basically done with the coding,
 but being a beginner myself, I feel I need some do some critics so I can
 improve (especially on the compiletime ones).

 I could have uploaded direct but I think the code may be way too long.

 Help will be dearly appreciated.
http://dpaste.dzfl.pl/f0bec44f859e - COMPILETIME_BM_PRE does it really need to be all caps? - initialisebmBc interesting naming convention that - Could do with a format (Mono-D supports this) - ~~~~~~~~~~ void suffixes(S, I, int i:-1)(S pattern, ref int[size] suff, I size, ref I f, ref int g){ } void main() { int a; suffixes("", null, 0, a, a); } ~~~~~ /d481/f560.d(1): Error: undefined identifier size, did you mean alias size_t? /d481/f560.d(5): Error: template f560.suffixes cannot deduce function from argument types !()(string, typeof(null), int, int, int), candidates are: /d481/f560.d(1): f560.suffixes(S, I, int i : -1)(S pattern, ref int[size] suff, I size, ref I f, ref int g) Final dummy code I could get working: ~~~~~~~~~~~~~~ void suffixes(S, I, int i:-1)(S pattern, ref int[] suff, I size, ref I f, ref int g){ } void main() { int a, c; int[] b; suffixes!(string, int, -1)("", b, 0, a, c); } ~~~~~~~~~~~~~~ Irk, that -1 should be inside a template if condition no there and certainly not using the colon. Also size must be passed in at compile time if being used in the static array like that. Otherwise pass it via a dynamic array like that. Currently it is really ugly. Format it. Mono-D can do this. Fix up those template arguments and function arguments. They are all wrong. There is no way that should compile.
Aug 13 2015