digitalmars.D - Following up from the reddit announcement
- Andrei Alexandrescu (2/2) Feb 24 2014 What's the matter with http://dpaste.dzfl.pl/ebd6ba43823f?
- safety0ff (4/6) Feb 24 2014 readf is returning 0 (the number of variables filled); it's not
- Steven Schveighoffer (12/13) Feb 24 2014 This is what happens when you close input (i.e. hit ctrl-d from a
- bearophile (7/9) Feb 24 2014 Also the code throws if just hit enter (it means you enter no
- bearophile (27/29) Feb 24 2014 I prefer code like this:
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (4/8) Feb 24 2014 I always put a space before the format specifier to ignore all whitespac...
- bearophile (9/10) Feb 24 2014 There are some problems there, this seems better:
- Shammah Chancellor (3/6) Feb 24 2014 Not sure what this is about, but when can we expect dlint?
- Brian Schott (3/5) Feb 24 2014 https://github.com/Hackerpilot/Dscanner#style-check
- Andrei Alexandrescu (4/9) Feb 25 2014 After std.lexer. I'm hoping us to also develop a "perfectpull" utility
- Jesse Phillips (9/11) Feb 24 2014 The exception is fairly clear:
- bearophile (4/10) Feb 25 2014 This little problem should go in Bugzilla.
- Jesse Phillips (2/15) Feb 25 2014 Done: https://d.puremagic.com/issues/show_bug.cgi?id=12260
What's the matter with http://dpaste.dzfl.pl/ebd6ba43823f? Andrei
Feb 24 2014
On Monday, 24 February 2014 at 22:05:46 UTC, Andrei Alexandrescu wrote:What's the matter with http://dpaste.dzfl.pl/ebd6ba43823f? Andreireadf is returning 0 (the number of variables filled); it's not changing the variable "input".
Feb 24 2014
On Mon, 24 Feb 2014 17:05:46 -0500, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:What's the matter with http://dpaste.dzfl.pl/ebd6ba43823f?This is what happens when you close input (i.e. hit ctrl-d from a console), without entering -1. readf is returning 0 meaning "I didn't get anything" and the code is ignoring it. I changed it to: if(readf("%s\n", &input) == 0) break; And it works fine. Note I had to add \n to the readf to use a one-number-per-line style (didn't make sense otherwise). -Steve
Feb 24 2014
Steven Schveighoffer:And it works fine. Note I had to add \n to the readf to use a one-number-per-line style (didn't make sense otherwise).Also the code throws if just hit enter (it means you enter no number). So the code is still bad. Also using sort instead of sort() is an anti-pattern that's going to be deprecated, hopefully in D 2.066. Bye, bearophile
Feb 24 2014
Also the code throws if just hit enter (it means you enter no number). So the code is still bad.I prefer code like this: void main() { import std.stdio, std.algorithm, std.string, std.array, std.conv; int[] even, odd; while (true) { "Enter a number (or just enter to exit): ".write; immutable txt = readln.strip; if (txt.empty) break; try { immutable input = txt.to!int; if (input % 2 == 0) { "even".writeln; even ~= input; } else { "odd".writeln; odd ~= input; } } catch (ConvException e) { "Not a number.".writeln; continue; } } odd.sort().writeln; even.sort().writeln; }
Feb 24 2014
On 02/24/2014 02:15 PM, Steven Schveighoffer wrote:if(readf("%s\n", &input) == 0) break; And it works fine. Note I had to add \n to the readf to use a one-number-per-line style (didn't make sense otherwise).I always put a space before the format specifier to ignore all whitespace: if (readf(" %s", &input) == 0) Ali
Feb 24 2014
Andrei Alexandrescu:What's the matter with http://dpaste.dzfl.pl/ebd6ba43823f?There are some problems there, this seems better: readf("%d\n", &input); Additionally readf() has a bug on Windows that I reported and it's still open in Bugzilla. (Extra note: I have a large D2 codebase, but I am strongly against freezing D2 development even more at this stage.) Bye, bearophile
Feb 24 2014
On 2014-02-24 22:05:46 +0000, Andrei Alexandrescu said:What's the matter with http://dpaste.dzfl.pl/ebd6ba43823f? AndreiNot sure what this is about, but when can we expect dlint? -S.
Feb 24 2014
On Tuesday, 25 February 2014 at 03:25:09 UTC, Shammah Chancellor wrote:Not sure what this is about, but when can we expect dlint? -S.https://github.com/Hackerpilot/Dscanner#style-check
Feb 24 2014
On 2/24/14, 7:25 PM, Shammah Chancellor wrote:On 2014-02-24 22:05:46 +0000, Andrei Alexandrescu said:After std.lexer. I'm hoping us to also develop a "perfectpull" utility that ensures a pull request is phobos-compatible at nitpick level. AndreiWhat's the matter with http://dpaste.dzfl.pl/ebd6ba43823f? AndreiNot sure what this is about, but when can we expect dlint?
Feb 25 2014
On Monday, 24 February 2014 at 22:05:46 UTC, Andrei Alexandrescu wrote:What's the matter with http://dpaste.dzfl.pl/ebd6ba43823f? AndreiThe exception is fairly clear: Unexpected ' ' when converting from type LockingTextReader to type int Though maybe: Unexpected '\n' when converting from type LockingTextReader to type int would be better.
Feb 24 2014
Jesse Phillips:Unexpected ' ' when converting from type LockingTextReader to type int Though maybe: Unexpected '\n' when converting from type LockingTextReader to type int would be better.This little problem should go in Bugzilla. Bye, bearophile
Feb 25 2014
On Tuesday, 25 February 2014 at 10:26:09 UTC, bearophile wrote:Jesse Phillips:Done: https://d.puremagic.com/issues/show_bug.cgi?id=12260Unexpected ' ' when converting from type LockingTextReader to type int Though maybe: Unexpected '\n' when converting from type LockingTextReader to type int would be better.This little problem should go in Bugzilla. Bye, bearophile
Feb 25 2014