[sv-bc] RE: [sv-ec] Formatting strings using %b ???

From: Jonathan Bromley <jonathan.bromley_at_.....>
Date: Fri Jun 22 2007 - 01:44:54 PDT
When a data object of string type is fed to a %b format specifier...
 
[Shalom Bresticker]

	%b in normal context prints 0s and 1s. I don't see any justification to
	display a string type as a string if %b is specified.
	 

[Dave Rich]

	The string data type is an unpacked aggregate. To convert to an integral
	type requires a cast, and under any other circumstance, this should be
	an error. However, an argument to a system task does not create an
	assignment context, so we are free to choose the behavior we want.

I don't think you are free so to choose.  See the paragraph 
in P1800 draft 3a that immediately follows Table 20-2:

	These [integer] format specifiers [...] shall not be used 
	with any unpacked aggregate type.

So, on more careful reflection I conclude that *both* simulators 
I tried are non-conforming.

Is this OK with everyone?  Or do we need a further change to 1789 
to permit automatic coercion of strings to packed arrays of bit by 
this set of system tasks?  From a user's viewpoint I would have been
much happier if my programming slip-up had been reported as an 
error, as indicated by the LRM text I quote above.
 
-- 

Jonathan Bromley


-- This message has been scanned for viruses anddangerous content by MailScanner, and isbelieved to be clean.
Received on Fri Jun 22 01:45:28 2007

This archive was generated by hypermail 2.1.8 : Fri Jun 22 2007 - 01:47:18 PDT