public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* typedefs
@ 2005-11-21 21:09 Manu Abraham
  2005-11-22  1:23 ` typedefs Giovanni Bajo
  0 siblings, 1 reply; 3+ messages in thread
From: Manu Abraham @ 2005-11-21 21:09 UTC (permalink / raw)
  To: gcc

Hi,

When one does a

typedef uint8_t array[10];

what does really happen ?


For example, i was looking at some code in the public domain, which had 
it like this ..

u8 is again typedef'd from a unsigned char

#define TS_PACKET_SIZE 188
#define TS_IN_UDP 7

typedef u8 file_ts_packet[TS_PACKET_SIZE];
typedef file_ts_packet udp_packet[TS_IN_UDP];

struct s_own_pcr
{
     int start, end;
     pthread_mutex_t lock;
     file_ts_packet *buf[(TS_BUFFER_SIZE+1)*TS_IN_UDP+1];
};


struct s_in_data
{
     int start, end;
     pthread_mutex_t lock;
     pthread_cond_t notfull;
     pthread_cond_t notempty;
     int b_die;
     udp_packet buf[TS_BUFFER_SIZE+1];
};



So i was wondering what buf would be now. it will be a 1 dimensional array ?
If it is a 1 dimensional array, what could this part of the code 
probably mean .. ?

     /* If we have 2 consecutiv PCR, we can reevaluate slope */
     if( (own_pcr.start != own_pcr.end) &&
         no_discontinuity &&
         !((((u8*) next_pcr = own_pcr.buf[own_pcr.start]))[5] & 0x80))
     {

	....
	....
}

I was wondering what the last condition could probably mean ..


Thanks,
Manu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: typedefs
  2005-11-21 21:09 typedefs Manu Abraham
@ 2005-11-22  1:23 ` Giovanni Bajo
  2005-11-22 13:27   ` typedefs Dave Korn
  0 siblings, 1 reply; 3+ messages in thread
From: Giovanni Bajo @ 2005-11-22  1:23 UTC (permalink / raw)
  To: Manu Abraham; +Cc: gcc

Manu Abraham <abraham.manu@gmail.com> wrote:

> When one does a
>
> typedef uint8_t array[10];
>
> what does really happen ?

This question does not concern the development of the GCC compiler in any way,
so it does not belong here. Please post it to support forums for th eC
language.

Giovanni Bajo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: typedefs
  2005-11-22  1:23 ` typedefs Giovanni Bajo
@ 2005-11-22 13:27   ` Dave Korn
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Korn @ 2005-11-22 13:27 UTC (permalink / raw)
  To: 'Giovanni Bajo', 'Manu Abraham'; +Cc: gcc

Giovanni Bajo wrote:
> Manu Abraham <abraham.manu> wrote:
> 
>> When one does a
>> 
>> typedef uint8_t array[10];
>> 
>> what does really happen ?
> 
> This question does not concern the development of the GCC compiler in any
> way

  ??? Unless, surely, the answer wanted was something along the lines of:

  `The front end creates a tree structure of type ARRAY_TYPE, which has a
TYPE_NAME of "array", a TYPE_DOMAIN member which points to an INTEGER_TYPE
tree struct that has TYPE_MIN_VALUE equal to INTEGER_CST 0 (most likely
integer_zero_node) and TYPE_MAX_VALUE equal to INTEGER_CST 9, and a TREE_TYPE
that points to the INTEGER_TYPE for uint8_t that was created earlier. [ ... ]'

  ...no ?

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-22 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-21 21:09 typedefs Manu Abraham
2005-11-22  1:23 ` typedefs Giovanni Bajo
2005-11-22 13:27   ` typedefs Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).