Prev: Embedded systems programmers worldwide earn failing grades in C
Next: 837858 Up to date Net and Tech news, knowledge, empowerment 41
From: Michael R on 20 Jan 2010 22:47 Hi folks, I was re-organizing some code and wanted to change some procedure/ function names, e.g., function To_String (T : My_Type) return String; becomes function Name (T : My_Type) return String; Without consulting the docs, I tried function Name (T : My_Type) return String; function To_String (T : My_Type) return String renames Name; pragma Deprecated (To_String); I guess I'm too used to annotating methods in Java and was surprised I couldn't do this in Ada. The only way to do this is to simply rename and fix the compilation errors which is may be in the Ada style: just get it right. Take care, Michael.
From: Jeffrey R. Carter on 20 Jan 2010 22:57 Michael R wrote: > > function Name (T : My_Type) return String; > function To_String (T : My_Type) return String > renames Name; > pragma Deprecated (To_String); "Deprecated" is not a language-defined pragma, but unrecognized pragmas should be ignored (ARM 2.8). I see nothing wrong with your function renaming. What error message did you get? -- Jeff Carter "Every sperm is sacred." Monty Python's the Meaning of Life 55
From: Michael R on 20 Jan 2010 23:00 On Jan 20, 7:57 pm, "Jeffrey R. Carter" <spam.jrcarter....(a)spam.acm.org> wrote: > Michael R wrote: > > > function Name (T : My_Type) return String; > > function To_String (T : My_Type) return String > > renames Name; > > pragma Deprecated (To_String); > > "Deprecated" is not a language-defined pragma, but unrecognized pragmas should > be ignored (ARM 2.8). I see nothing wrong with your function renaming. What > error message did you get? > > -- > Jeff Carter > "Every sperm is sacred." > Monty Python's the Meaning of Life > 55 Hi, Yes, it generated a warning as un-recognized but I was hoping for the functionality, i.e., the implementation of this pragma where usage of the old name generates deprecated warning when used. Take care, Michael.
From: Ludovic Brenta on 21 Jan 2010 04:30
Michael R wrote on comp.lang.ada: > On Jan 20, 7:57 pm, "Jeffrey R. Carter" >>> function Name (T : My_Type) return String; >>> function To_String (T : My_Type) return String >>> renames Name; >>> pragma Deprecated (To_String); > >> "Deprecated" is not a language-defined pragma, but unrecognized pragmas should >> be ignored (ARM 2.8). I see nothing wrong with your function renaming. What >> error message did you get? > > Yes, it generated a warning as un-recognized but I was hoping for the > functionality, i.e., the implementation of this pragma where usage > of the old name generates deprecated warning when used. GNAT has an implementation-defined "pragma Obsolescent", see http://gcc.gnu.org/onlinedocs/gnat_rm/Pragma-Obsolescent.html -- Ludovic Brenta. |