www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - printf() problems

reply john <john_member pathlink.com> writes:
Hi all

I'm trying to write a sudoku puzzle solver in D, but printf() starts printing
mostly wrong characters and acting very erratically halfway through the program.
I stuck in print statements to find where exactly in the code the problem was
starting, and it happens in the middle of this loop:

for(i=0;i<9;i++)   
{
for(j=0;j<9;j++)
{
for(k=0;k<10;k++)
{
poss[i][j][k]=1;
}
}
}

poss[9][9][10] is of type bit, does this have anything to do with it?  Any help
is very much appreciated.  Thanks,

John
Dec 09 2005
next sibling parent Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
Try using writef instead of printf. How are you calling printf anyway ? 
Does it work when you change the array type from bit to int ?


john wrote:
 I'm trying to write a sudoku puzzle solver in D, but printf() starts printing
 mostly wrong characters and acting very erratically halfway through the
program.
 I stuck in print statements to find where exactly in the code the problem was
 starting, and it happens in the middle of this loop:

-- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/
Dec 09 2005
prev sibling next sibling parent reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
john schrieb:

 Hi all
 
 I'm trying to write a sudoku puzzle solver in D, but printf() starts
 printing mostly wrong characters and acting very erratically halfway
 through the program. I stuck in print statements to find where exactly in
 the code the problem was starting, and it happens in the middle of this
 loop:
 
 for(i=0;i<9;i++)
 {
 for(j=0;j<9;j++)
 {
 for(k=0;k<10;k++)
 {
 poss[i][j][k]=1;
 }
 }
 }
 
 poss[9][9][10] is of type bit, does this have anything to do with it?  Any
 help
 is very much appreciated.  Thanks,
 
 John

Hmmm.... don't see any printf() statement there... What do you mean it behaves erratically? Can you give an example? Please be aware that printf() is from the standard-C library and should be used with carefull! Namely you should be carefull which parameters (type) you pass to it! Have you tried writef()? Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Dec 09 2005
parent reply john <john_member pathlink.com> writes:
In article <dnbjct$gdr$1 digitaldaemon.com>, Tiago Gasiba says...
john schrieb:

 Hi all
 
 I'm trying to write a sudoku puzzle solver in D, but printf() starts
 printing mostly wrong characters and acting very erratically halfway
 through the program. I stuck in print statements to find where exactly in
 the code the problem was starting, and it happens in the middle of this
 loop:
 
 for(i=0;i<9;i++)
 {
 for(j=0;j<9;j++)
 {
 for(k=0;k<10;k++)
 {
 poss[i][j][k]=1;
 }
 }
 }
 
 poss[9][9][10] is of type bit, does this have anything to do with it?  Any
 help
 is very much appreciated.  Thanks,
 
 John

Hmmm.... don't see any printf() statement there... What do you mean it behaves erratically? Can you give an example? Please be aware that printf() is from the standard-C library and should be used with carefull! Namely you should be carefull which parameters (type) you pass to it! Have you tried writef()? Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.

There isn't any printing going on in that loop...printf worked before the loop and fails during the loop. I tried printing within the loop and halfway through it fouled up. Afterwards, printf is printing some correct characters but mostly randomness from the extended ASCII codes. Does the writef syntax mimic that of printf? How is it different?
Dec 09 2005
parent reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
john schrieb:

 In article <dnbjct$gdr$1 digitaldaemon.com>, Tiago Gasiba says...
john schrieb:

 Hi all
 
 I'm trying to write a sudoku puzzle solver in D, but printf() starts
 printing mostly wrong characters and acting very erratically halfway
 through the program. I stuck in print statements to find where exactly
 in the code the problem was starting, and it happens in the middle of
 this loop:
 
 for(i=0;i<9;i++)
 {
 for(j=0;j<9;j++)
 {
 for(k=0;k<10;k++)
 {
 poss[i][j][k]=1;
 }
 }
 }
 
 poss[9][9][10] is of type bit, does this have anything to do with it? 
 Any help
 is very much appreciated.  Thanks,
 
 John

Hmmm.... don't see any printf() statement there... What do you mean it behaves erratically? Can you give an example? Please be aware that printf() is from the standard-C library and should be used with carefull! Namely you should be carefull which parameters (type) you pass to it! Have you tried writef()? Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.

There isn't any printing going on in that loop...printf worked before the loop and fails during the loop. I tried printing within the loop and halfway through it fouled up. Afterwards, printf is printing some correct characters but mostly randomness from the extended ASCII codes. Does the writef syntax mimic that of printf? How is it different?

writef() works very much like printf(). See this: http://www.digitalmars.com/d/phobos/std_stdio.html Without any reproducible code it's very difficult... The following code works fine for me (bit is implicitly promoted to int). <snip> int main(){ bit poss[10][10][10]; int i,j,k; for(i=0;i<9;i++){ for(j=0;j<9;j++){ for(k=0;k<10;k++){ poss[i][j][k]=1; printf("%d ",poss[i][j][k]); } printf("\n"); } } return 0; } <snip> Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Dec 09 2005
next sibling parent reply john <john_member pathlink.com> writes:
In article <dnbm2l$mbs$1 digitaldaemon.com>, Tiago Gasiba says...
john schrieb:

 In article <dnbjct$gdr$1 digitaldaemon.com>, Tiago Gasiba says...
john schrieb:

 Hi all
 
 I'm trying to write a sudoku puzzle solver in D, but printf() starts
 printing mostly wrong characters and acting very erratically halfway
 through the program. I stuck in print statements to find where exactly
 in the code the problem was starting, and it happens in the middle of
 this loop:
 
 for(i=0;i<9;i++)
 {
 for(j=0;j<9;j++)
 {
 for(k=0;k<10;k++)
 {
 poss[i][j][k]=1;
 }
 }
 }
 
 poss[9][9][10] is of type bit, does this have anything to do with it? 
 Any help
 is very much appreciated.  Thanks,
 
 John

Hmmm.... don't see any printf() statement there... What do you mean it behaves erratically? Can you give an example? Please be aware that printf() is from the standard-C library and should be used with carefull! Namely you should be carefull which parameters (type) you pass to it! Have you tried writef()? Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.

There isn't any printing going on in that loop...printf worked before the loop and fails during the loop. I tried printing within the loop and halfway through it fouled up. Afterwards, printf is printing some correct characters but mostly randomness from the extended ASCII codes. Does the writef syntax mimic that of printf? How is it different?

writef() works very much like printf(). See this: http://www.digitalmars.com/d/phobos/std_stdio.html Without any reproducible code it's very difficult... The following code works fine for me (bit is implicitly promoted to int). <snip> int main(){ bit poss[10][10][10]; int i,j,k; for(i=0;i<9;i++){ for(j=0;j<9;j++){ for(k=0;k<10;k++){ poss[i][j][k]=1; printf("%d ",poss[i][j][k]); } printf("\n"); } } return 0; } <snip> Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.

Actually changing poss from bit to int made the problem stop. I thought bit worked just like booleans in java, but something went awry.
Dec 09 2005
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
john wrote:

 Actually changing poss from bit to int made the problem stop.  I thought bit
 worked just like booleans in java, but something went awry.  

bit works more like _Bool does in C. :-P Except a little bit worse... It (booleans) and strings are the biggest problems for newcomers to D. --anders
Dec 09 2005
prev sibling parent Tiago Gasiba <tiago.gasiba gmail.com> writes:
john schrieb:
 
 Actually changing poss from bit to int made the problem stop.  I thought
 bit worked just like booleans in java, but something went awry.

Great! Nice knowing everything is fine now. When you have first sent the message, I didn't know what Sudoku was... Afterwards I have seen the game on a local newspaper and noticed that this game seems to be very appreciated by people now. There are even small pocket computers for sale for this kind of game... Therefore, I have also decided to write a Sudoku solver in D. Surprisingly, though, the problem is quite trivial to be solved! It only took me about two hours to devise an algorithm and to write it in D! I have ran it over two problems found in newspaper, and solved them quite easily. You can check my version here - http://www.gasiba.de/D/sudoku.d Would be nice to compare the running times between your version and mine. The next step is how to create Sudoku tables, which, using the program I wrote is also a trivial task... Best, Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Dec 12 2005
prev sibling parent john <john_member pathlink.com> writes:
In article <dnbm2l$mbs$1 digitaldaemon.com>, Tiago Gasiba says...
john schrieb:

 In article <dnbjct$gdr$1 digitaldaemon.com>, Tiago Gasiba says...
john schrieb:

 Hi all
 
 I'm trying to write a sudoku puzzle solver in D, but printf() starts
 printing mostly wrong characters and acting very erratically halfway
 through the program. I stuck in print statements to find where exactly
 in the code the problem was starting, and it happens in the middle of
 this loop:
 
 for(i=0;i<9;i++)
 {
 for(j=0;j<9;j++)
 {
 for(k=0;k<10;k++)
 {
 poss[i][j][k]=1;
 }
 }
 }
 
 poss[9][9][10] is of type bit, does this have anything to do with it? 
 Any help
 is very much appreciated.  Thanks,
 
 John

Hmmm.... don't see any printf() statement there... What do you mean it behaves erratically? Can you give an example? Please be aware that printf() is from the standard-C library and should be used with carefull! Namely you should be carefull which parameters (type) you pass to it! Have you tried writef()? Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.

There isn't any printing going on in that loop...printf worked before the loop and fails during the loop. I tried printing within the loop and halfway through it fouled up. Afterwards, printf is printing some correct characters but mostly randomness from the extended ASCII codes. Does the writef syntax mimic that of printf? How is it different?

writef() works very much like printf(). See this: http://www.digitalmars.com/d/phobos/std_stdio.html Without any reproducible code it's very difficult... The following code works fine for me (bit is implicitly promoted to int). <snip> int main(){ bit poss[10][10][10]; int i,j,k; for(i=0;i<9;i++){ for(j=0;j<9;j++){ for(k=0;k<10;k++){ poss[i][j][k]=1; printf("%d ",poss[i][j][k]); } printf("\n"); } } return 0; } <snip> Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.

I thought bit worked like boolean in java, but changing poss to type int solves the problem. Thanks everybody.
Dec 09 2005
prev sibling parent reply "Lionello Lunesu" <lio remove.lunesu.com> writes:
Uh.... Making a sudoku solver by any chance??? (me too!)

L. 
Dec 09 2005
next sibling parent "Lionello Lunesu" <lio remove.lunesu.com> writes:
Sorry, I only saw the code, didn't see you actually mention making the 
solver.. The code was _so_ familiar, since I'm working on exactly the same 
thing RIGHT NOW!  I was so shocked that I replied immediately..

L. 
Dec 09 2005
prev sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Lionello Lunesu wrote:
 Uh.... Making a sudoku solver by any chance??? (me too!)

I've written one already, but it would be interesting to see how the ones you two are writing work in comparison. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Dec 12 2005
next sibling parent reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
Stewart Gordon schrieb:

 Lionello Lunesu wrote:
 Uh.... Making a sudoku solver by any chance??? (me too!)

I've written one already, but it would be interesting to see how the ones you two are writing work in comparison. Stewart.

Would be nice to compare your version and mine in terms of speed / code size, etc... Best, Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Dec 12 2005
parent reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
Tiago Gasiba schrieb:

 Stewart Gordon schrieb:
 
 Lionello Lunesu wrote:
 Uh.... Making a sudoku solver by any chance??? (me too!)

I've written one already, but it would be interesting to see how the ones you two are writing work in comparison. Stewart.

Would be nice to compare your version and mine in terms of speed / code size, etc... Best, Tiago

The solution implemented by myself was looking too simple - and in fact it is! Initially I though that this would be the ultimate solution, but I was wrong. There are very hard Sudoku tables that are damm difficult to solve - even for software. You can take a look at the following website: http://www.sudokusolver.co.uk/ In particular here: http://www.sudokusolver.co.uk/grids_nologic.html I'm happy with my code and will not work any further on this. If someone writes a D program to solve these difficult tables... please let us know. Best, Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Dec 12 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Tiago Gasiba wrote:
<snip>
 The solution implemented by myself was looking too simple - and in fact it is!
 Initially I though that this would be the ultimate solution, but I was wrong.
 There are very hard Sudoku tables that are damm difficult to solve - even for
software.
 You can take a look at the following website: http://www.sudokusolver.co.uk/
 In particular here: http://www.sudokusolver.co.uk/grids_nologic.html
 I'm happy with my code and will not work any further on this.
 If someone writes a D program to solve these difficult tables... please let us
know.

If it can't be solved by logic, then it isn't a true Sudoku. But I'll take those challenge puzzles home and see how far my program gets with solving them. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Dec 12 2005
next sibling parent reply Oskar Linde <oskar.lindeREM OVEgmail.com> writes:
Stewart Gordon wrote:
 Tiago Gasiba wrote:
 <snip>
 
 The solution implemented by myself was looking too simple - and in 
 fact it is!
 Initially I though that this would be the ultimate solution, but I was 
 wrong.
 There are very hard Sudoku tables that are damm difficult to solve - 
 even for software.
 You can take a look at the following website: 
 http://www.sudokusolver.co.uk/
 In particular here: http://www.sudokusolver.co.uk/grids_nologic.html
 I'm happy with my code and will not work any further on this.
 If someone writes a D program to solve these difficult tables... 
 please let us know.


What's the price? :) The solution is very easy, just plug a depth-first search into your Sodoku solver, or for a more generic puzzle solving program, implement it using Dancing Links (Knuth, 2000).
 If it can't be solved by logic, then it isn't a true Sudoku.  But I'll 
 take those challenge puzzles home and see how far my program gets with 
 solving them.

It depends on your definition of logic. Isn't the following logic: Assume A -> Leads to inconsistency (*) Therefore !A (*) may of course be a very long chain of events. If this is logic, all single solution Sodoku puzzles are solvable by logic. (Back-tracking search aka depth first search) Or is human logic defined to have a limited search depth? :) /Oskar
Dec 12 2005
parent Tiago Gasiba <tiago.gasiba gmail.com> writes:
Oskar Linde schrieb:

 Stewart Gordon wrote:
 Tiago Gasiba wrote:
 <snip>
 
 The solution implemented by myself was looking too simple - and in
 fact it is!
 Initially I though that this would be the ultimate solution, but I was
 wrong.
 There are very hard Sudoku tables that are damm difficult to solve -
 even for software.
 You can take a look at the following website:
 http://www.sudokusolver.co.uk/
 In particular here: http://www.sudokusolver.co.uk/grids_nologic.html
 I'm happy with my code and will not work any further on this.
 If someone writes a D program to solve these difficult tables...
 please let us know.


What's the price? :) The solution is very easy, just plug a depth-first search into your Sodoku solver, or for a more generic puzzle solving program, implement it using Dancing Links (Knuth, 2000).
 If it can't be solved by logic, then it isn't a true Sudoku.  But I'll
 take those challenge puzzles home and see how far my program gets with
 solving them.

It depends on your definition of logic. Isn't the following logic: Assume A -> Leads to inconsistency (*) Therefore !A (*) may of course be a very long chain of events. If this is logic, all single solution Sodoku puzzles are solvable by logic. (Back-tracking search aka depth first search) Or is human logic defined to have a limited search depth? :) /Oskar

However, logic means (IMHO) that each decision you take is a final decision - i.e. no guessing, no consistency test, etc... They have software that solves these problems with guessing but not "by logic" :) Tiago Gasiba -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Dec 12 2005
prev sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Stewart Gordon wrote:
 Tiago Gasiba wrote:

 http://www.sudokusolver.co.uk/
 In particular here: http://www.sudokusolver.co.uk/grids_nologic.html
 I'm happy with my code and will not work any further on this.
 If someone writes a D program to solve these difficult tables... 
 please let us know.

If it can't be solved by logic, then it isn't a true Sudoku. But I'll take those challenge puzzles home and see how far my program gets with solving them.

What a nuisance! I saved the page onto my USB drive, but hadn't realised that the content is in an invisible iframe and so didn't get saved. So I brought my program here, and at first I thought I'd exposed a bug in my solver, but it turns out to be a bug in GDC (which I'll have to try and track down) stopping it working on this Mac. Oh well, BLNT.... Meanwhile, here's my program. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Dec 13 2005
parent reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
Stewart Gordon schrieb:

 
 Oh well, BLNT....
 
 Meanwhile, here's my program.
 
 Stewart.
 

Didn't manage to get your program to choke. However, with the initial matrix: <snip> .2. ... ... ... 6.. ..3 .74 .8. ... ... ..3 ..2 .8. .4. .1. 6.. 5.. ... ... .1. 78. 5.. ..9 ... ... ... .4. <snip> which is one of the "non-logic-solvable" tables in the website, I get the following answer with your program: <snip> .26 ..7 ..8 895 62. .73 .74 .8. ... 457 193 862 983 246 517 612 578 ..4 2.9 .1. 78. 548 7.9 ... 7.1 8.2 .4. <snip> and the solution is (according to the website): <snip> 126 437 958 895 62. 473 374 985 126 457 193 862 983 246 517 612 578 394 2.9 314 785 548 7.9 231 731 852 649 <snip> Your program preforms very well and also puts mine into shame, because the result from mine is: <snip> - 2 6 - - - - - - - - - 6 - - - - 3 - 7 4 - 8 - - - - - - - - - 3 - - 2 - 8 - - 4 - - 1 - 6 - - 5 - - - - - - - - - 1 - 7 8 - 5 - - - - 9 - - - - - - - - - - 4 - <snip> However, notice that before writing the program I didn't know what Sudoku was and it only took me 2hrs to devise the algorithm and write it down in D. :) I have compiled your program with DMD on Linux. Didn't notice any problem with it. The bug you have must be GDC specific. Best, Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Dec 13 2005
parent reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
Tiago Gasiba schrieb:

 
 and the solution is (according to the website):
 
 <snip>
 126 437 958
 895 62. 473
 374 985 126
 
 457 193 862
 983 246 517
 612 578 394
 
 2.9 314 785
 548 7.9 231
 731 852 649
 <snip>
 

Oops... forgot to copy-paste a few numbers Here it goes the final (complete) and unique solution: 126 437 958 895 621 473 374 985 126 457 193 862 983 246 517 612 578 394 269 314 785 548 769 231 731 852 649 Best, Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Dec 13 2005
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
Tiago Gasiba wrote:
<snip>
 Oops... forgot to copy-paste a few numbers
 Here it goes the final (complete) and unique solution:
 
 126 437 958
 895 621 473
 374 985 126
 
 457 193 862
 983 246 517
 612 578 394
 
 269 314 785
 548 769 231
 731 852 649

That's strange. When I tried it, the first one it solved was number 10. The only thing that mine does that the website doesn't is the refinePerms function, which is a generalisation of C and D. If you comment out the call to this, you'll see that it doesn't solve. But my program doesn't implement method E or F at all. A generalisation of F that shouldn't be too hard to implement is to enumerate the arrangements of each number throughout the grid and refine the options in a similar way to refinePerms. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Dec 15 2005
prev sibling parent reply "Lionello Lunesu" <lio remove.lunesu.com> writes:
Mine is not working well :-(
It's my first D project using DBC and I get assertions allover the place... 
I now need assertions for my assertions, since I'm no longer sure I can 
assert certain things :-S

Actually it works, but it's far from smart. There are plenty of tricks that 
I haven't implemented yet.

http://www.lunesu.com/sudoku.zip

WARNING: unclean code!

L. 
Dec 16 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Lionello Lunesu wrote:
 Mine is not working well :-(
 It's my first D project using DBC and I get assertions allover the place... 
 I now need assertions for my assertions, since I'm no longer sure I can 
 assert certain things :-S
 
 Actually it works, but it's far from smart. There are plenty of tricks that 
 I haven't implemented yet.
 
 http://www.lunesu.com/sudoku.zip
 
 WARNING: unclean code!

Maybe. But I'm still totally perplexed about why you've chosen to invent a boolean type with the true/false values reversed. Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Dec 16 2005
parent reply "Lionello Lunesu" <lio remove.lunesu.com> writes:
 Maybe.  But I'm still totally perplexed about why you've chosen to invent 
 a boolean type with the true/false values reversed.

Uh.. because they're initialized to 0 :-S That's the actual reason, I'm not making it up. The class itself started pretty clean, but the algorithm is a mess, mostly because I kept rewriting it, trying to get rid of some assertions that kept failing... L.
Dec 16 2005
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Lionello Lunesu wrote:
 Maybe.  But I'm still totally perplexed about why you've chosen to invent 
 a boolean type with the true/false values reversed.

Uh.. because they're initialized to 0 :-S That's the actual reason, I'm not making it up.

I see now. Could've been done with typedef byte possible = true; (Ideally it should be bool, but the bug with GDC on Mac OS X seems to kick in when I do it that way.) Stewart. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d- s:- C++ a->--- UB P+ L E W++ N+++ o K- w++ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y ------END GEEK CODE BLOCK------ My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Dec 16 2005
parent "Lionello Lunesu" <lio remove.lunesu.com> writes:
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message 
news:dnu9bc$1shk$1 digitaldaemon.com...
 Lionello Lunesu wrote:
 Maybe.  But I'm still totally perplexed about why you've chosen to 
 invent a boolean type with the true/false values reversed.

Uh.. because they're initialized to 0 :-S That's the actual reason, I'm not making it up.

I see now. Could've been done with typedef byte possible = true;

Aaaah, right.. This thing was actually the first D file that wasn't just a snippet.. I was learning new D stuff on the way... L.
Dec 16 2005