Re: [vhdl-200x] RE: Vote Cancelled: VHDL + VHPI (P1076c-2006-D2.4a)]

From: Evan Lavelle <eml-vhdl-200x_at_.....>
Date: Tue Jul 11 2006 - 03:34:19 PDT
I've just had a quick look through vhpi_user.h on eda.org (I wasn't 
actually aware it was there). The char and sized-integer handling needs 
cleaning up. For instance, we have

> typedef int             PLI_INT32;
> typedef unsigned int    PLI_UINT32;
> typedef short           PLI_INT16;
> typedef unsigned short  PLI_UINT16;
> typedef char            PLI_BYTE8;
> typedef unsigned char   PLI_UBYTE8;
...
> typedef char vhpiCharT;


1 - 'plain' char is a distinct type (it is neither a 'signed char' nor 
an 'unsigned char' type), and the standards don't specify whether it is 
treated as signed or unsigned; this is up to the compiler. For short, 
int, and long, specifying 'signed' is optional, since objects of these 
types are signed unless the 'unsigned' keyword is used. This isn't true 
of char.

2 - In C and C++, a char is a byte, and sizeof(char) is 1. However, a 
"byte" is not necessarily 8 bits; the standard only says that CHAR_BIT 
is required to be at least 8. This is probably not relevant - I guess 
nothing actually requires a char to be 8 bits?

3 - Most C/C++ coding standards prohibit the use of 'plain char', except 
when it is required in the API for an existing library

4 - The macros in inttypes.h/stdint.h should be used for standardised 
typedefs for integers of a known size; ie. uint8_t, uint32_t, etc.

5 - What's going on in:

> #define VHPI_GET_PRINTABLE_STRINGCODE( ch )  VHPICharCodes[PLI_UBYTE8 ch]

is '[PLI_UBYTE8 ch]' meant to be a typecast (it isn't)?

Evan
Received on Tue Jul 11 03:34:25 2006

This archive was generated by hypermail 2.1.8 : Tue Jul 11 2006 - 03:35:05 PDT