* Character Type? @ 1999-01-26 0:00 Chris 1999-01-26 0:00 ` Tom Moran 1999-01-27 0:00 ` Bill Ghrist 0 siblings, 2 replies; 5+ messages in thread From: Chris @ 1999-01-26 0:00 UTC (permalink / raw) I have to make a program that can declare a range of characters from '1'..'10' I have been trying everything but I can't seem to find anything that will work. This is what I have so far: SUBTYPE Index IS Character RANGE '1'..'10'; TYPE X IS ARRAY (Index) OF Character; TYPE Y IS ARRAY (Index) OF Character; Any help would be GREATLY appreciated. ~Chris ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Character Type? 1999-01-26 0:00 Character Type? Chris @ 1999-01-26 0:00 ` Tom Moran 1999-01-27 0:00 ` Bill Ghrist 1 sibling, 0 replies; 5+ messages in thread From: Tom Moran @ 1999-01-26 0:00 UTC (permalink / raw) > range of characters from >'1'..'10' "10" sure looks like two characters to me. How about '1' .. '9' or '0' .. '9'? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Character Type? 1999-01-26 0:00 Character Type? Chris 1999-01-26 0:00 ` Tom Moran @ 1999-01-27 0:00 ` Bill Ghrist 1999-01-27 0:00 ` Simon Wright 1999-01-28 0:00 ` robert_dewar 1 sibling, 2 replies; 5+ messages in thread From: Bill Ghrist @ 1999-01-27 0:00 UTC (permalink / raw) To: Chris Well, I'm pretty new with Ada, but the obvious problem, I think, is that '10' is not a character, it is a string. Regards, Bill Ghrist Chris wrote: > > I have to make a program that can declare a range of characters from > '1'..'10' I have been trying everything but I can't seem to find anything > that will work. This is what I have so far: > > SUBTYPE Index IS Character RANGE '1'..'10'; > > TYPE X IS ARRAY (Index) OF Character; > TYPE Y IS ARRAY (Index) OF Character; > > Any help would be GREATLY appreciated. > > ~Chris ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Character Type? 1999-01-27 0:00 ` Bill Ghrist @ 1999-01-27 0:00 ` Simon Wright 1999-01-28 0:00 ` robert_dewar 1 sibling, 0 replies; 5+ messages in thread From: Simon Wright @ 1999-01-27 0:00 UTC (permalink / raw) Bill Ghrist <ghristwd@pgh.net> writes: > Well, I'm pretty new with Ada, but the obvious problem, I think, is that > '10' is not a character, it is a string. I don't think it's either! GNAT 3.11p (981118) Copyright 1992-1998 Free Software Foundation, Inc. Compiling: blug.adb (source file time stamp: 1999-01-27 22:11:18) 1. with Text_Io; 2. procedure Blug is 3. begin 4. Text_Io.Put_Line ('10'); | >>> strings are delimited by double quote character 5. end Blug; 5 lines: 1 error gnatmake: "blug.adb" compilation error ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Character Type? 1999-01-27 0:00 ` Bill Ghrist 1999-01-27 0:00 ` Simon Wright @ 1999-01-28 0:00 ` robert_dewar 1 sibling, 0 replies; 5+ messages in thread From: robert_dewar @ 1999-01-28 0:00 UTC (permalink / raw) In article <36AF1CB3.BC7741B4@pgh.net>, ghristwd@pgh.net wrote: > Well, I'm pretty new with Ada, but the obvious problem, I > think, is that '10' is not a character, it is a string. That's confusingly wrong. Strings in Ada are delimited with the character " The character ' is used to delimit character literals. The sequence of characters '10' is not anything at all, it is simply invalid, as is easily seen from the grammar rules in the RM. Now in general of course, you might be right, that if you see '10' it could be that the programmer intended a string, and indeed GNAT makes this guess: 1. procedure j is 2. x : character := '10'; | >>> strings are delimited by double quote character 3. begin 4. null; 5. end; However, in the original program, it clearly was NOT intended to be a string, in fact from the original program I certainly have no idea what the programmer had in mind, it was clearly very muddled thinking, so it is certainly not surprising that the compiler could not magically suggest what the programmer had in mind in this particular case :-) -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1999-01-28 0:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1999-01-26 0:00 Character Type? Chris 1999-01-26 0:00 ` Tom Moran 1999-01-27 0:00 ` Bill Ghrist 1999-01-27 0:00 ` Simon Wright 1999-01-28 0:00 ` robert_dewar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox