| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8
Comments:
<0> on a typical compiler, an int can represent -2 billion to 2 billion, since that 4 billion different values needs to be split between negatives and positives <1> oh <0> g-gao: http://www.gmonline.demon.co.uk/cscene/CS9/CS9-02.html or read some other tutorial/book on the subject <1> thankyou Alipha!!! THIS IS WHAT I WAS LOOKING FOR <1> i will study this hard <2> sourcecode editor for linxu? <2> for c code <1> so Alipha if you format it as a long double will it take up more space than an int <0> g-gao: yes <0> well, rather, most likely. (the exact sizes of types aren't specified by the C standard--though there's some restrictions. an int *could* be larger than a long double) <1> how? <1> isnt long double 80 bits <1> and int is 32 <0> those aren't guarenteed sizes. <0> on 64-bit platforms, an int could very well be 64 bits if the compiler chooses. on old DOS days, ints were often 16-bit. i could design my own compiler and make ints 93 bits if i wanted :-P
<1> i dont get it =.= <0> ..the size of an int depends upon the compiler. <1> oh <0> the C standard requires an int to be at least 16bits though. <1> will 5555555 take up more space than 5? <3> i thought it was really kept with the differnet system arfchitectures <0> g-gao: no, but if an int is only 16-bits, you may not be able to store 5555555 in an int and you would get a compiler warning. <4> Alipha: most programs would not work with 16 bit ints <0> aet: those are bad programs then ;-) they should be using longs <1> so the amount of digits doesn't affect the size? <1> i srsly dont get this <1> can u explain it again <0> no. for a specific compiler, an int is always the same size. but that size can change from compiler to compiler. <5> hullo <3> give him a bit lineup <0> g-gao: on your compiler, an int probably can store between -2 billion to 2 billion. but if i used an old DOS compiler, an int would probably only be able to hold between -32768 and 32767 <1> yes <0> so what's the question? <1> so even an int that was 2, 000 , 000 holds the same amount of memory as "0" <0> yes <1> howcome <1> it holds more information <1> lots more digits <5> alipha: djgpp was an old dos compiler, it's ints were 32 bits. <0> no <1> doesnt that take more memory <3> someone draw this <4> g-gao: it would be hard/slow for cpu to compress em <3> probably horribly inefficient <1> what?! <1> why doesnt the int "2000000" take more space than "0" <0> g-gao: it holds the same amount of information, you just don't see the leading 0's. int x = 20000; /* x is holding 0000020000 */ int y = 1; /* y is holding 0000000001 */ <3> http://en.wikipedia.org/wiki/Integer_(computer_science) <0> g-gao: it's like a box. the box takes up the same amount of space whether or not the box is full or empty <5> ggao: because the computer stores it that way... all integers are the exact same width, they just have a bunch of leading zeros if they are small. <1> oh i see11 <1> so each int is always the same <5> the computer stores them that way because it is easier for the computer to deal with when they are a known size. <0> g-gao: yes <1> i get it now <3> always the same n that architecture atleast <1> 0000020000 <5> ggao: well, internally everything is just 1's and 0's. <1> howocme there are 5 0's before the 20000 <5> all binary numbers... <6> Argh, you are still on that <5> so the number "2" doesn't really exist in the computer. all the digits are either 0 or 1. Because they are binary they are called "bits" instead of "digits". <1> yeh <5> every integer is some fixed number of bits wide... if not all of them are needed, then leading bits are zero (for positive numbers) <1> uh u lost me <5> they are a fixed number of bits wide to make the electronics that performs arithmetic on them easy to develop and cheap to build. <6> An int on your arch is 32 bits, no matter what you put in it <1> arch? <6> Architecture <5> architecture, g-gao <1> so what would the int "1" look like in bits <5> 00000000000000000000000000000001 <1> really? <5> really <1> and 3? <1> is it 10
<0> 00000000000000000000000000000011 <1> ohh i get it <5> yup... what alipha said. <3> theres 10 kinda of people, those who read binary and those who dont :/ <5> 00000000000000000000000000000010 is actually the number 2. <1> why doesnt the computer just write 2 and save a lot of memory <5> ggao: well, it might look more efficient for really small numbers, but once you go over ten thousand, it's not any more. <6> And store how many bits are used, for each variable? And have memory addressing not work with a fixed width of data? And... Okay, don't bother about this for now <6> You'll understand eventually, really <7> do any of you guys use purify? <5> ggao: But as I said, the computer expects integers to be some fixed width so that it is easier and cheaper to create the electronics for them. <3> not to mention keep track of how big each type is <7> [W] MLK: Memory leak of 13352 bytes from 17 blocks allocated in EnumClipboardFormats [USER32.dll] < is this a problem in the dll or my code? <1> where did u guys learn all this?!! <5> books, school... <3> google springs to mind:P <1> what is the topic called so i can google it <3> i pasted a good article about integers from wikipedia earlier:P <5> g-gao: computer architecture... but based on the knowledge you appear to have, I expect googling it would give you incomprehensible pages. <1> yteh i got it open <3> most good c programming books will explain this <3> in detail <3> and theres tons of free articles :/ <5> rip: I don't know if they will explain WHY an int always uses the same number of bits... even if most of them are 0. <3> i think some links in that wikipedia article covers that too <1> wikipedia is so hard to undersatnd though <3> markt, dunno, i read it *somewhere* :P <5> ggao: how old are you, exactly? <1> how old do u think i am <3> i blame the drugs. <3> im just gonna guess... 13? <1> lol! <1> :p <5> so how old? <1> 13 <3> t-t-t-t troll-unit <1> how old did u think i was MarkT- <5> I have no idea <1> how old r u mark <5> 42 <1> wow lots of expierience then <3> damn i feel young heh <3> when ppl say 42 <5> okay,,, so how old are you? <5> because if you want to learn this stuff, it's important that you find a source that doesn't talk down to you like you just learned how to read. <1> (02:48:57) (+rip) im just gonna guess... 13? <1> (02:49:07) (+g-gao) lol! <1> (02:49:10) (+g-gao) :p <1> (02:49:31) (+MarkT-) so how old? <1> (02:49:34) (+g-gao) 13 <1> yeh <1> i hate it how everyone always is mean coz im a noob <1> i ask nooby questions <5> Oh... I thought you were just saying that because you were laughing at his answer. <5> g-gao: what made you join this channel? <1> learning c <5> g-gao: don't. <1> why not? <3> what about reading a book :) <1> why cant i learn c <6> Ah, this makes sense now. Read a book and feel free to ask us when you have some questions beyond the basics <5> oh, you CAN learn C.... <3> first you gotta learn to read books <1> what basics <3> wax on, wax off <1> i know how to use a computer <6> The basics you will find in a C book <5> the basics of C, yes... <3> when you can catch a fly with chopsticks, then you can master wa...err C <1> any ebooks? <5> but not WHY an integer is always the same width... <6> I started with C at 13, MarkT-, it's harsh but possible <5> ggao: do you know what a byte is? <1> yes
Return to
#c or Go to some related
logs:
#hardware bevarian pretzel
#gentoo ddos abandonia how to cook kangoroo meat irssi +piespy +imager tasry #politics pump exed #politics
|
|