D - What am I missing?
- Scott Egan (14/14) Apr 20 2004 This compiles but, I get 'opCmp: Error: Access Violation'
- J Anderson (5/21) Apr 20 2004 printf("opCmp: %.*s", s ~ "\0" );
- Scott Egan (4/34) Apr 20 2004 Sorry, I'll try not to be so stupid in the future (but I can't promise
- J Anderson (10/13) Apr 21 2004 I wouldn't worry about it. Most people don't have time to
- J C Calvarese (6/23) Apr 21 2004 Are you thinking of something like this?
- J Anderson (6/19) Apr 21 2004 Exactly but ... parhaps it could be ordered in a way that shows (what
- J C Calvarese (14/36) Apr 21 2004 Someone has helped us out with the ordering of the FAQ in the wiki in th...
- J Anderson (6/13) Apr 21 2004 Just thought someone would do a better job then me. Ok I've simplified
- J C Calvarese (5/24) Apr 21 2004 Thanks.
- Ilya Minkov (10/32) Apr 20 2004 From here s points to constant array literal.
- Andrew (2/16) Apr 20 2004
- Ben Hinkle (5/5) Apr 20 2004 printf("opCmp: %s", s ~ "\0" );
- J Anderson (8/14) Apr 20 2004 It would be cool if we could have a bot that automaticly directed these
- J C Calvarese (8/25) Apr 20 2004 In the meantime, we could take turns manually directing them to:
- Stewart Gordon (9/15) Apr 20 2004 Or
- Ben Hinkle (3/6) Apr 20 2004 oh yeah - it had been so long since I last toStringz'ed something I
This compiles but, I get 'opCmp: Error: Access Violation' Any thoughts? class fred { char[] opAdd(fred a){ return "Hello"; } } int main(char[][] args) { fred f = new fred(); fred g = new fred(); char[] s; s = g + f; printf("opCmp: %s", s ~ "\0" ); return 0; }
Apr 20 2004
Scott Egan wrote:This compiles but, I get 'opCmp: Error: Access Violation' Any thoughts? class fred { char[] opAdd(fred a){ return "Hello"; } } int main(char[][] args) { fred f = new fred(); fred g = new fred(); char[] s; s = g + f; printf("opCmp: %s", s ~ "\0" );printf("opCmp: %.*s", s ~ "\0" ); If of D arrays as a struct with a length at the front.return 0; }-- -Anderson: http://badmama.com.au/~anderson/
Apr 20 2004
Sorry, I'll try not to be so stupid in the future (but I can't promise anything). "J Anderson" <REMOVEanderson badmama.com.au> wrote in message news:c63314$22ci$1 digitaldaemon.com...Scott Egan wrote:This compiles but, I get 'opCmp: Error: Access Violation' Any thoughts? class fred { char[] opAdd(fred a){ return "Hello"; } } int main(char[][] args) { fred f = new fred(); fred g = new fred(); char[] s; s = g + f; printf("opCmp: %s", s ~ "\0" );printf("opCmp: %.*s", s ~ "\0" ); If of D arrays as a struct with a length at the front.return 0; }-- -Anderson: http://badmama.com.au/~anderson/
Apr 20 2004
Scott Egan wrote:Sorry, I'll try not to be so stupid in the future (but I can't promise anything).I wouldn't worry about it. Most people don't have time to read\understand the entire language specs before using it. I'm thinking about putting a extremely brief page on the wiki with "common errors/solutions" listed by the most commonly asked. And a link on the main page - "noobies click here". s ~ "\0" shows you almost had the right idea and coming from C++, it's an obvious mistake to make. I'm guessing that most people have done it at least once. -- -Anderson: http://badmama.com.au/~anderson/
Apr 21 2004
J Anderson wrote:Scott Egan wrote:Are you thinking of something like this? http://www.wikiservice.at/d/wiki.cgi?ErrorMessagesSorry, I'll try not to be so stupid in the future (but I can't promise anything).I wouldn't worry about it. Most people don't have time to read\understand the entire language specs before using it. I'm thinking about putting a extremely brief page on the wiki with "common errors/solutions" listed by the most commonly asked.And a link on the main page - "noobies click here". s ~ "\0" shows you almost had the right idea and coming from C++, it's an obvious mistake to make. I'm guessing that most people have done it at least once.-- Justin http://jcc_7.tripod.com/d/
Apr 21 2004
J C Calvarese wrote:J Anderson wrote:Exactly but ... parhaps it could be ordered in a way that shows (what probably are) then most common first. Also have a big emphasize on the main page to get noobs there. -- -Anderson: http://badmama.com.au/~anderson/Scott Egan wrote:Are you thinking of something like this? http://www.wikiservice.at/d/wiki.cgi?ErrorMessagesSorry, I'll try not to be so stupid in the future (but I can't promise anything).I wouldn't worry about it. Most people don't have time to read\understand the entire language specs before using it. I'm thinking about putting a extremely brief page on the wiki with "common errors/solutions" listed by the most commonly asked.
Apr 21 2004
In article <c65nak$ev4$1 digitaldaemon.com>, J Anderson says...J C Calvarese wrote:Someone has helped us out with the ordering of the FAQ in the wiki in the last few days. I didn't realize how much it needed reordering. I'm really glad he made those changes. But the ordering of the error messages page makes sense to me. If you think it can be ordered better, I'd encourage you to reorder it. I think that's the idea of a wiki. (By the way, there's already a table of contents at the top of the page and most browsers have a Find command.) As far as encouraging people to get to the right page in the wiki, I don't know what else I can do. The wiki FAQ page has a blurb mentioning the error messages page now. Perhaps some of the FAQ questions aren't so frequently asked, but some effort has been made to organize them so that the important ones are found first. JustinJ Anderson wrote:Exactly but ... parhaps it could be ordered in a way that shows (what probably are) then most common first. Also have a big emphasize on the main page to get noobs there.Scott Egan wrote:Are you thinking of something like this? http://www.wikiservice.at/d/wiki.cgi?ErrorMessagesSorry, I'll try not to be so stupid in the future (but I can't promise anything).I wouldn't worry about it. Most people don't have time to read\understand the entire language specs before using it. I'm thinking about putting a extremely brief page on the wiki with "common errors/solutions" listed by the most commonly asked.-- -Anderson: http://badmama.com.au/~anderson/
Apr 21 2004
J C Calvarese wrote:As far as encouraging people to get to the right page in the wiki, I don't know what else I can do. The wiki FAQ page has a blurb mentioning the error messages page now. Perhaps some of the FAQ questions aren't so frequently asked, but some effort has been made to organize them so that the important ones are found first. JustinJust thought someone would do a better job then me. Ok I've simplified the front page a more and added a special message to D's biggest customers, C++ users. -- -Anderson: http://badmama.com.au/~anderson/
Apr 21 2004
J Anderson wrote:J C Calvarese wrote:Thanks. -- Justin http://jcc_7.tripod.com/d/As far as encouraging people to get to the right page in the wiki, I don't know what else I can do. The wiki FAQ page has a blurb mentioning the error messages page now. Perhaps some of the FAQ questions aren't so frequently asked, but some effort has been made to organize them so that the important ones are found first. JustinJust thought someone would do a better job then me. Ok I've simplified the front page a more and added a special message to D's biggest customers, C++ users.
Apr 21 2004
J Anderson schrieb:Scott Egan wrote:Always returns a constant array literal.This compiles but, I get 'opCmp: Error: Access Violation' Any thoughts? class fred { char[] opAdd(fred a){ return "Hello"; } }From here s points to constant array literal.int main(char[][] args) { fred f = new fred(); fred g = new fred(); char[] s; s = g + f;doesn't matter here, since pointer is the first in the function parameter parsing queue. Maybe the error happens at concatenation - but why? I think only assembly level debugging would help here. Besides, try splitting away concatenation onto a separate line. Make a new variable, don't use =~ else you might loose the bug. Sorry that i can't be more helpful at the moment. -eyeprintf("opCmp: %s", s ~ "\0" );printf("opCmp: %.*s", s ~ "\0" ); If of D arrays as a struct with a length at the front.
Apr 20 2004
In article <c631su$20rf$1 digitaldaemon.com>, Scott Egan says...This compiles but, I get 'opCmp: Error: Access Violation' Any thoughts? class fred { char[] opAdd(fred a){ return "Hello"; } } int main(char[][] args) { fred f = new fred(); fred g = new fred(); char[] s; s = g + f; printf("opCmp: %s", s ~ "\0" );Try %.*sreturn 0; }
Apr 20 2004
printf("opCmp: %s", s ~ "\0" ); This should either be (as other have said) printf("opCmp: %.*s", s ~ "\0" ); or printf("opCmp: %s", (char*)(s ~ "\0") );
Apr 20 2004
Ben Hinkle wrote:printf("opCmp: %s", s ~ "\0" ); This should either be (as other have said) printf("opCmp: %.*s", s ~ "\0" ); or printf("opCmp: %s", (char*)(s ~ "\0") );It would be cool if we could have a bot that automaticly directed these questions to the wiki <g> ie it would search for two words, printf and %s, 97% of the time I reckon it would hit correct (sorry for sending a personal email :( ) -- -Anderson: http://badmama.com.au/~anderson/
Apr 20 2004
J Anderson wrote:Ben Hinkle wrote:In the meantime, we could take turns manually directing them to: http://www.wikiservice.at/d/wiki.cgi?FaqRoadmap#RuntimeErrors or http://www.wikiservice.at/d/wiki.cgi?ErrorMessages -- Justin http://jcc_7.tripod.com/d/printf("opCmp: %s", s ~ "\0" ); This should either be (as other have said) printf("opCmp: %.*s", s ~ "\0" ); or printf("opCmp: %s", (char*)(s ~ "\0") );It would be cool if we could have a bot that automaticly directed these questions to the wiki <g> ie it would search for two words, printf and %s, 97% of the time I reckon it would hit correct (sorry for sending a personal email :( )
Apr 20 2004
Ben Hinkle wrote:printf("opCmp: %s", s ~ "\0" ); This should either be (as other have said) printf("opCmp: %.*s", s ~ "\0" );Which makes the null terminator redundant.printf("opCmp: %s", (char*)(s ~ "\0") );Or printf("opCmp: %s", toStringz(s) ); Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Apr 20 2004
oh yeah - it had been so long since I last toStringz'ed something I had forgotten all about it. I'll take that as a good sign :-) -Benprintf("opCmp: %s", (char*)(s ~ "\0") );Or printf("opCmp: %s", toStringz(s) );
Apr 20 2004