TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
"Borgia, William M." <[log in to unmask]>
Wed, 3 Mar 1999 11:27:35 -0500
"Borgia, William M." <[log in to unmask]>
text/plain (38 lines)
> -----Original Message-----
> From: Borgia, William M.
> Sent: Wednesday, March 03, 1999 11:27 AM
> To:   [log in to unmask]
> Subject:      RE: The March of Progress
> If you want to make the contrast more dramatic, add some plain text, a
> variable-length string, and an integer in hexadecimal.
> How many lines does it take to do this in Ada, C++, or Java:
>       printf("The result for %-30s is %10.2f (%08x)\n", x, y, z);
> My question: Has anyone written good Ada equivalents to printf and
> scanf?
> Mike
> I think that this is exactly the point.  Most developers acknowledge that
> printf and scanf are some of the most flexible, powerful library methods
> in any language.  Because of this, however, they are quite difficult for
> the average guy maintaining or reviewing the software to understand.  To
> put it mildly, they rely on a large set of cryptic formatting characters.
> They also rely on being able to send a variable number of parameters,
> which Ada does not allow -- this is why C/C++ places parameters on the
> stack in backwards order.
> Without looking at a reference, I can't understand what the line of code
> above attempts to do.  I do understand what Wes accomplishes because he
> uses a simple function and the parameter semantics are meaningful because
> of named parameter association.
> In short, I'd rather see a few lines of code that I can understand at a
> glance rather than one that requires a more knowledge or a reference.
> Bill