Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to extract bytes from a long?

Reply
Thread Tools

How to extract bytes from a long?

 
 
cody
Guest
Posts: n/a
 
      10-17-2003
"Sheldon Simms" <(E-Mail Removed)> schrieb im Newsbeitrag
news(E-Mail Removed)...
> On Fri, 17 Oct 2003 01:36:19 +0200, Irrwahn Grausewitz wrote:
>
> > Sheldon Simms <(E-Mail Removed)> wrote:
> >
> > <snip>
> >>Jetzt weißt du. Aber ich glaube nicht, dass Eric von den
> >>Grammatikunterschiede sprach, sondern dass Amerikaner zu
> >>oft ihre eigene Muttersprache nur schlecht beherrschen.
> >>
> >>Übrigens, ich bin Amerikaner, also darf ich sowas sagen.

> >
> > Did you ever read de.comp.lang.c?

>
> I did
>
> > If so, what is your impression
> > about the skills of Germans regarding their native language?

>
> I was so enthralled by the never-ending fights over whether people
> have .signatures of the proper length, or have a valid email address
> in their headers, or why one shouldn't use a nickname when posting,
> etc., that I didn't have time to consider the grammar.



That's the reason why I as a german prefer to use english newsgroups instead
of german ones! There are so many stupid and irrelevant discussions about
proper capitalisation and realnames and so. Additionally I like english cos
I find it is more functional than german.


--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk


 
Reply With Quote
 
 
 
 
Mark McIntyre
Guest
Posts: n/a
 
      10-17-2003
On Fri, 17 Oct 2003 20:15:47 +0200, in comp.lang.c , "cody"
<(E-Mail Removed)> wrote:

>> > struct { long lng} A;
>> > struct { char byt[sizeof (long)] } B;


>Does that apply to my struct too? Iam not really sure wheather long and
>char[sizeof(long)] are compatible in this situation.


The answer is NO. Can you pass a char[] to a function expecting a
long? Can you pass a long to a function expecting a char? The standard
means what it says - the initial sequence of the two structs must be
identical in type.

>If you find a mistake in my postings please said whats wrong do that i can
>do it better next time.


Its "please say" rather than "please said". Said is the past tense.
Also please capitalise the letter i when used as the personal pronoun,
as I have done here.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
 
Reply With Quote
 
 
 
 
cody
Guest
Posts: n/a
 
      10-17-2003
"Mark McIntyre" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> On Fri, 17 Oct 2003 20:15:47 +0200, in comp.lang.c , "cody"
> <(E-Mail Removed)> wrote:
>
> >> > struct { long lng} A;
> >> > struct { char byt[sizeof (long)] } B;

>
> >Does that apply to my struct too? Iam not really sure wheather long and
> >char[sizeof(long)] are compatible in this situation.

>
> The answer is NO. Can you pass a char[] to a function expecting a
> long? Can you pass a long to a function expecting a char? The standard
> means what it says - the initial sequence of the two structs must be
> identical in type.
>
> >If you find a mistake in my postings please said whats wrong do that i

can
> >do it better next time.

>
> Its "please say" rather than "please said". Said is the past tense.
> Also please capitalise the letter i when used as the personal pronoun,
> as I have done here.



Thx.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk


 
Reply With Quote
 
Serve La
Guest
Posts: n/a
 
      10-19-2003
"Christian Bau" <(E-Mail Removed)> wrote in message
news:christian.bau-201190.23210115102003@slb-> > > > Isn't that what a union
is good for???
>
> Stay with freeware. Don't even think about getting a paid job as a
> programmer.


It can be far worse. I work with somebody who didn't even know C has unions.


 
Reply With Quote
 
Joe Wright
Guest
Posts: n/a
 
      10-19-2003
Serve La wrote:
>
> "Christian Bau" <(E-Mail Removed)> wrote in message
> news:christian.bau-201190.23210115102003@slb-> > > > Isn't that what a union
> is good for???
> >
> > Stay with freeware. Don't even think about getting a paid job as a
> > programmer.

>
> It can be far worse. I work with somebody who didn't even know C has unions.


And dues-paying union members.
--
Joe Wright http://www.jw-wright.com
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
 
Reply With Quote
 
Mike Wahler
Guest
Posts: n/a
 
      10-19-2003

"Serve La" <(E-Mail Removed)> wrote in message
news:bmtgk7$hr8$(E-Mail Removed)1.nb.home.nl...
> "Christian Bau" <(E-Mail Removed)> wrote in message
> news:christian.bau-201190.23210115102003@slb-> > > > Isn't that what a

union
> is good for???
> >
> > Stay with freeware. Don't even think about getting a paid job as a
> > programmer.

>
> It can be far worse. I work with somebody who didn't even know C has

unions.

Hopefully he's not a member of a union as well.

-Mike


 
Reply With Quote
 
Peter Shaggy Haywood
Guest
Posts: n/a
 
      10-21-2003
Groovy hepcat cody was jivin' on Fri, 17 Oct 2003 00:23:18 +0200 in
comp.lang.c.
Re: How to extract bytes from a long?'s a cool scene! Dig it!

>"Eric Sosman" <(E-Mail Removed)> schrieb im Newsbeitrag
>news:(E-Mail Removed)...
>> cody wrote:
>> > Note the special guarantee:
>> > [#5] With one exception, if the value of a member of a union
>> > object is used when the most recent store to the object was
>> > to a different member, the behavior is
>> > implementation-defined.6 One special guarantee is made in
>> > order to simplify the use of unions: If a union contains
>> > several structures that share a common initial sequence (see
>> > below), and if the union object currently contains one of
>> > these structures, it is permitted to inspect the common
>> > initial part of any of them anywhere that a declaration of
>> > the completed type of the union is visible. Two structures
>> > share a common initial sequence if corresponding members
>> > have compatible types (and, for bit-fields, the same widths)
>> > for a sequence of one or more initial members

>>
>> The special guarantee applies only to union members
>> that happen to be structs, and only to structs if they
>> "share a common initial subsequence." The union you
>> exhibited contained no structs at all, and is not covered
>> by the special guarantee.

>
>#include <stdio.h>
>union X
>{
> struct { long lng} A;
> struct { char byt[sizeof (long)] } B;
>};
>
>And now? Two structs with a common starting point.


Yes, but no common initial sequence. Both of these structures
contain completely different data types. They have nothing in common,
except their starting address. But that's not what the above passage
is about.

>> Are you having trouble understanding the English in
>> which the Standard is written?

>
>I try my best
>
>> You appear to be posting
>> from a .de address, which might indicate that your native
>> language is German.

>
>That is correct, I'm german.
>
>> The great number of grammatical errors
>> in your written English makes me think you must be American,
>> but if not -- well, your English is better than my German,

>
>I didn't know grammar of American and British is different.


Who said they're different? Eric said there were gammatical errors,
not differences in (correct) grammar. And I think it was a
tongue-in-cheek slight at the Yanks.

>> but perhaps not equal to the task of deciphering Standardese.

>
>Honestly, not a simple task.


Even for those of us with a good grasp on English grammar.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Ratio of Bytes Delayed to Bytes Sent netproj Cisco 0 12-21-2005 08:08 PM
Private Bytes vs. # Bytes in all Heaps in Perfmon Jason Collins ASP .Net 3 02-18-2004 03:59 PM
Re: receiving Bytes and sending Bytes Ieuan Adams Computer Support 0 07-24-2003 07:46 PM
Re: receiving Bytes and sending Bytes The Old Sourdough Computer Support 0 07-23-2003 01:23 PM



Advertisments