Thread overview | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 08, 2002 Some errors | ||||
---|---|---|---|---|
| ||||
D people : I have found some errors during a simple program coding. I dont know if are errors or misunderstanding, but you could evaluate and give a final word. The error are in the nexts post in this thread. Juarez Rudsatz |
July 08, 2002 error with printing | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module erro1; import c.stdio; void main(){ // First error : comparing strings with slices char[] s = '1234'; printf(s[0..3] ~ \n); if ('124' == s[0..3]) printf('Test 1'); else if ('123' == s[0..3]) printf('Test 2'); else if ('124' === s[0..3]) printf('Test 3'); else if ('123' === s[0..3]) printf('Test 4'); else printf('Failed'); // second error : constant string permited in if if ('value') printf(\n'Test 5'\n); // next error : semicollon list permited in if if ('value' , s[1..2], 987) printf('Test 6'\n); // Last error : switch with no case allowed switch(s){ default: } } |
July 08, 2002 Error with charset | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module error2; import c.stdio; void main() { // -> D outputs strings in ASCII codepage and not ANSI on windows printf("Portuguese special chars : áàãâéèêíóõôú" ~\n); // D outputs \n not as \n\r in Windows printf("Execute this program and redirect to a file:\n error > output.txt"); } |
July 08, 2002 error with char[].sort | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module error3; import c.stdio; void main() { // Bug on sorting strings char[][] string; string.length = 2; string[1] = 'cba'; string[0] = 'zyx'; // This sorts the strings string.sort; // This will crash the compiler string[0].sort; // This will give sintax error //string[0].sort(); printf(string[0]); printf(string[1]); } |
July 08, 2002 Error with private? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module error4; class Xyz { private void SetParam(char[] option) { // no call for SetParam must be a error ? } } void main() { } |
July 08, 2002 error with string concatenation | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module error5; char[] returnSameString(char[] inputstr) { return inputstr; } // This gives a error char[] passString() { return returnSameString('First string' ~ "Concatenated with second"); } char[] butThisWorks() { char[] s = 'First string'; s = s ~ "Concatenated with second"; return returnSameString(s); } main() { } |
July 08, 2002 error with module statement ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module error12345; // The module stament could be ommited or wrong typed. // Is this right ? void main() { } |
July 08, 2002 error message with linking | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module error7; /* When compiling only this module gives some linking error A better message "No main function" for novices ? Is too hard? */ class Xyz { } |
July 08, 2002 error message of switch and empty strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module error8; void main() { char[] s; s = ''; // Error message to ugly switch(s) { case 'a' : return; case 'b' : return; } } |
July 08, 2002 debug and semantic | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | module error9; void main() { char s; debug(5) { // Semantical errors are not detected in debug. // Only syntatical are. How I can assure if a // program is debugable? s.Value.Anything.Value(); } } |
Copyright © 1999-2021 by the D Language Foundation