recommendations of email account providers or have a go at my C question.
Mark Blackman
mark at blackmans.org
Thu Jun 21 21:19:33 BST 2001
On Thu, Jun 21, 2001 at 04:03:06PM +0100, Tim Borgeaud wrote:
>
>
> My old University account is about to expire. So I'm looking for
> a new email account somewhere. I'd love shell/web/ftp services but
> a simple email account would do.
>
> The account would be for personal and FreeBSD list related email.
> I'd like to be able to enable some kind of filtering (on the host
> machine) and to be able to get my email easily from home and work
> so I'd prefer not to use POP.
<plug class="blatant">
could try netscalibur.co.uk :) and use IMAP.
sign up online (with CC handy) at ..
http://www.netscalibur.co.uk/services/1_1_1_dial.html
</plug>
>
>
> Here's the C question - it's not really a problem but I'd like to
> know if something can be done or not (I suspect not).
>
> Imagine I have a data array or some sort and a void pointer to this
> data:
>
> void *My_data;
>
> Now suppose that the data is a series of 2 byte integers (short).
> I decide that I want one of these integers found at an offset.
>
> ((short *)My_data + offset) is then the pointer to this integer.
>
> Now I have a function foo which is defined as
>
> double foo(int *bar); the int is 32bit
>
> I'd like to use the My_data array and offset directly (no matter
> how ugly the code looks) :
>
> foo( &((int)*((short *)My_data + offset))
>
> But I can't do this because of the cast from short to int.
> I can't use the & operator on the casted data -
> (int)*((short *)My_data + offset) is not an l-value.
>
> I am assuming this is equivalent of something like
>
> foo( &(atoi("10")) );
>
> But is there something about casts that I don't know that would allow
> another way of doing this?
>
This is de-referencing a int pointer and it will actually give you
the 32bit value residing at that offset (i.e. two shorts slammed together).
You should either shift the short value into a temporary 32 bit container
or rewrite the entire data array as ints. Does foo attempt to read more
than the first 32bit int at *bar?
- Mark
More information about the Ukfreebsd
mailing list