• (cs) in reply to MightyM
  • (cs) in reply to MightyM
    MightyM:
    Pero perić:
    In the QBASIC, an ancient languages targeting 16 bit environment, one could specify an array with up to 60 dimensions. Is it even possible to use half of that (without trivial, one element dimensions) withing 64 kB?

    Not even close, if every dimension was size 2 and the datatype size was 1 byte you would need 1,152,921,504,606,846,976 bytes.

    Pretty amazing considering QBASIC had to run within the 640k that DOS could use!

  • Ironside (unregistered) in reply to Boomslang
    Boomslang:
    Nagesh:
    Obvious WTF is programming in low level languages. Best stick to language like Java and you see less and less WTF every day.

    Quite the opposite. If a programmer never uses a low-level language to, for example, poke hardware or manage memory, he is more likely to make less efficient software, just because he doesn't understand what's going on beneath the hood.

    No Nagesh is right (or rather, if you believe such matters are subjective, I agree with Nagesh), programming in low level languages opens the door to a whole slew of novel WTFs that can be avoided by programming in eg Java or C# or even VB.Net, mainly to do with memory management.

  • (cs) in reply to acne
    acne:
    Jens:
    It's 68 MB if you know one specification or 64 MiB if use the other. It is 64 MB if you don't know what you are talking about or if you are stuck in the 90s.
    You were too fast for me... Here are the details for those who still do not know: http://en.wikipedia.org/wiki/Binary_prefix

    I assume these prefixes were made up by the same type of twits who are Wikipedia "editors". TRWTF is in believing that Wikipedia is authoritative.

  • Ironside (unregistered)

    QBasic almost hit the limit then. 64 dimensions are enough for anyone. Not even a resonance cascade requires more than that.

  • moving through space (unregistered) in reply to Jens
    Jens:
    No, the power of two thing only worked as long as computer nerds were people hidden in attics only talking to their own kind. As soon as computers were used by real people en masse the traditional meaning of kilo broke through.

    I mean who was so retarded to say "oh, 1024 is nearly 1000, let's misuse the greek word for thousand for it and redefine it to something it doesn't in any scientific area or anywhere else" instead of inventing anything for this?

    The problem today is more that the once-leading computer science nation has a tendency to use completely incoherent unit (and value display) systems that no one else in the world uses. So in that country it doesn't matter much when there is another unit that doesn't fit into any system. For the rest of the world it does.

    Are you seriously trying to convince us that "real people" became concerned when the number of bytes available didn't seem to make logical sense and that is why we have this mibi gibi crap? The only person I ever heard try to push this was an low-level support guy who was desperate to show that he had some useful knowledge. He's still trying.

    As for the masses? Who cares, they don't understand either set of prefixes.

  • Bruce (unregistered) in reply to Pero perić
    Pero perić:
    In the QBASIC, an ancient languages targeting 16 bit environment, one could specify an array with up to 60 dimensions.

    63, in fact.

    VBA still lets you to do just that. Or at least try.

    Today I was looking at a chunk of code that would take that 63-dimensional array and tell you how many elements there were.

    I mean, it might be needed some day. Y2K, neva forgit!

  • Bruce (unregistered) in reply to MightyM
    MightyM:
    Not even close, if every dimension was size 2 and the datatype size was 1 byte you would need 1,152,921,504,606,846,976 bytes.

    1,152,921,504,606,846,976 bytes * 2 * 2 * 2.

  • moving through space (unregistered) in reply to Nagesh
    Nagesh:
    Obvious WTF is programming in low level languages. Best stick to language like Java and you see less and less WTF every day.
    That may be true for a lot of programmers, but if someone didn't use giant printing presses and cutters and packagers to begin with, what would you use to build your house of cards?
  • (cs) in reply to gnasher729
    gnasher729:
    2 Megabit per second is and always was two million bits per second or 2,000,000 bits per second. It never has been anything else. Just like 2 Megahertz is and always was two million cycles per second. And there is a slow process on the way convincing the very last retards that when you copy data at a speed of 2 Megabit per second for eight seconds, you'll have copied eight Megabyte. Not some strange number of pseudo-Megabytes.
    Um, no, a 2 megabit ADSL line was always 2048000 bits per second, because the telecoms industry uses decimal thousands - a 56K modem (in Europe, anyway, where they weren't slightly hobbled by some weird FCC rule) was in theory capable of reaching 56000 bits per second, no more. So an ISDN line gave one or two 64K (64000) bits per second channels, possibly bonded into a single 128K (128000) bits per second channel. And a first-gen consumer ADSL line gave 512K (512000) bits per second. The later ADSL lines gave 1M (1024K, 1024000) bits per second, later still came 2M (2048K, 2048000) bits per second and so on.

    And don't forget the mighty 1.44MB floppy, which was 1.44 kilokibibytes (KKiB) (2880 = 2.88 decimal kilo of 0.5 binary kilobyte sectors). This is a different prefix to that found on the telecoms kibikilobit (KiKB).

    Bah.

  • (cs) in reply to Ironside
    Ironside:
    Boomslang:
    Nagesh:
    Obvious WTF is programming in low level languages. Best stick to language like Java and you see less and less WTF every day.

    Quite the opposite. If a programmer never uses a low-level language to, for example, poke hardware or manage memory, he is more likely to make less efficient software, just because he doesn't understand what's going on beneath the hood.

    No Nagesh is right (or rather, if you believe such matters are subjective, I agree with Nagesh), programming in low level languages opens the door to a whole slew of novel WTFs that can be avoided by programming in eg Java or C# or even VB.Net, mainly to do with memory management.

    In return for avoiding the low-level programming memory management WTFs, the higher-level languages like Java and friends provide a whole slew of memory-management WTFs of their own.

    And anyway, TRWTF is that someone agreed with Nagesh.

  • (cs) in reply to Jan
    Jan:
    I have never, /ever/ heard anyone say 'kibibyte' in real life, and I don't expect I ever will. It's plain nonsense.
    More to the point, it sounds too much like "Kibbles and Bytes"...
  • Sir William Gates (unregistered)

    It's not the size that matters, 640k ought to be enough for anybody....

  • Grzechooo (unregistered) in reply to Sir William Gates
    Sir William Gates:
    It's not the size that matters, 640k ought to be enough for anybody....
    Ain't that a misquote?
  • just old i guess (unregistered) in reply to alexgieg
    Mike:
    That's because -- AFAIK at least -- HDDs have always been measured in powers of ten.

    Funny that... I seem to recall my 128 megabyte, 256 megabyte, and 512 megabyte hard drives all using those numbers... not 120/130, 250/260, or 510.

    Really the whole "10s" bit didn't come about until the gigabyte stage.

    And I personally never understood the issue.... byte is (currently) an octal number, not decimal. So why in the heck would anyone try to make decimal math rules apply?

  • Sir William Gates (unregistered)

    Also, you can have a successful marriage even if you're "micro" and "soft"...

    P.S: Captcha: vulputate sounds really dirty but apparently not even a real word according to my online search...

  • xTr1m (unregistered)

    ERROR! Not enough memory to display the

  • (cs)

    Is it me or the more the involved WTF is simple in code terms the more the comments are prone to some neverending loop of stupid/pointless arguments on the little bits of it?

    TRWTF is that neither Schrödinger's Cat nor nazis are involved yet... I read mostly nothing of it, so I may be wrong.

  • (cs)

    Linux uses optimistic memory allocation by default. This shouldn't take up a full 64MB unless you access several pages of that array.

    If the device's CPU doesn't support this, it probably doesn't have a memory management unit (MMU). If this is the case, how is it even running Linux?

  • SirWired (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    And for all those of you thinking that all-decimal versus all-binary is the end of the matter, consider telecoms.

    A 2 megabit-per-second connection: is that mebibits or megabits?

    Answer: neither. It's two kibikilobits, 2KiKb for short.

    Alternatively, you think like an IT engineer and realize that various signal encoding schemes make counting by bits stupidly vague (unless you truly enjoy looking up the encoding efficiency of every protocol), and use Megabytes instead if you have real work to do.

  • Pero perić (unregistered) in reply to Le Poete
    Le Poete:
    You run out of memory, didn't you? :)
  • modifiable lvalue (unregistered)
    In languages like C, they’re low level structures, which represent direct access to memory.

    The low-level languages are the first and second generation programming languages. C is a third generation programming language, described by the standard in the context of an abstract machine. C isn't a low-level language.

    Consider that, at the truest low level, memory isn't contiguous. You might have a stick of 2GB of RAM and a stick of 4GB of RAM, but you can't rely upon these two sticks providing 6GB of contiguous storage. As an OS author on an Intel x86 platform, you have to write a bootloader that fits into 512 bytes of memory. The bootloader operates in real mode. Before you can address any storage requirements beyond 64KB, you need to operate in protected mode. This is low level programming, and standard C has none of it.

    Consider that, when you pass an array to a function, it is implicitly converted to a pointer to the first element. The same conversion occurs when you use the array[index] operator, because that operator is in reality a pointer[index] operator. Arrays can't provide any access to memory. The only operators they have is the &address-of operator (which results in a pointer) and the sizeof operator (which results in an integer size_t). The only way to access memory that an array contains is to convert the array to a pointer (silently) and use one of the pointer operations to choose which element to operate on.

    In C99, variable length arrays were introduced. Variable length arrays are arrays with sizes that are determined at runtime. They're automatically destroyed when the function they're created in returns.

    None of this comes natively, at the low level end. It comes from the compiler, which translates C source code into low(er) level machine code, or in some cases an interpreter, which translates C source code into behaviour (in which case, the memory especially can't be directly operated upon, because there's an interpreter between the processor and the program). It's the machine code, if present, that's low-level, not the C code. While I agree that the representation chosen to store the data in this article is a WTF, I think the true WTF is describing anything C-related with the term "low-level", especially when the description came from someone working with freestanding implementations as opposed to hosted implementations. You ought to know better!

  • TortoiseWrath (unregistered) in reply to One big flee
    One big flee:
    Texas is 696,200 km^2 or 696,200,000,000mm^2

    Nope. 1 km^2 = 1,000,000,000,000 mm^2. Note the ^2.

    Thus, Texas is 696,200,000,000,000,000 mm^2.

  • (cs) in reply to ammoQ
    ammoQ:
    Funny fact: An asteroid the size of Texas would kill all fleas, worldwide.
    So... that's a good thing, yes?
  • (cs)

    I can't believe there are two pages of comments and they're all about kibi/kilo terminology, transmission rates, and disk sizes, instead of the clever and provocative title to the article.

    What a bunch of nerds. (Well, I guess we know that.) Come on, try harder! Faster!

  • (cs) in reply to Y_F
    Y_F:
    Is it me or the more the involved WTF is simple in code terms the more the comments are prone to some neverending loop of stupid/pointless arguments on the little bits of it?

    TRWTF is that neither Schrödinger's Cat nor nazis are involved yet... I read mostly nothing of it, so I may be wrong.

    Every pointless argument thread simultaneously contains a discussion of Schrodinger's cat and the Nazis. This superposition exists until the reader actually reads the thread far enough, at which time the pointless thread wave function collapses, and one state is observed.

  • Alan (unregistered) in reply to qazwsx
    qazwsx:
    gnasher729:
    when you copy data at a speed of 2 Megabit per second for eight seconds, you'll have copied eight Megabyte.

    Hahaha what

    I think he meant eight Megaword

  • (cs) in reply to Alan
    Alan:
    qazwsx:
    gnasher729:
    when you copy data at a speed of 2 Megabit per second for eight seconds, you'll have copied eight Megabyte.

    Hahaha what

    I think he meant eight Megaword

    Where "word" signifies the price of a shave and a haircut.

  • Robin (unregistered) in reply to Dave
    Dave:

    You even quote the correct spelling, yet still manage to spell it wrong yourself no less than five times.

    • fewer
  • (cs) in reply to RichP
    RichP:
    Every pointless argument thread simultaneously contains a discussion of Schrodinger's cat and the Nazis. This superposition exists until the reader actually reads the thread far enough, at which time the pointless thread wave function collapses, and one state is observed.
    And Godwin's law points out clearly that that one state is always the same.
  • F (unregistered) in reply to ammoQ
    ammoQ:
    Funny fact: An asteroid the size of Texas would kill all fleas, worldwide.

    Not if it stayed in the asteroid belt.

  • (cs) in reply to Robin
    Robin:
    Dave:

    You even quote the correct spelling, yet still manage to spell it wrong yourself no less than five times.

    • fewer
    FAIL. "no less than" is a fossilised set phrase, and therefore not subject to the normal rules of 21st Century (or even 20th Century) grammar.
  • (cs) in reply to Steve The Cynic
    Steve The Cynic:
    RichP:
    Every pointless argument thread simultaneously contains a discussion of Schrodinger's cat and the Nazis. This superposition exists until the reader actually reads the thread far enough, at which time the pointless thread wave function collapses, and one state is observed.
    And Godwin's law points out clearly that that one state is always the same.
    You ruined it! Give my dualism back!!!
  • PaladinOfKaos (unregistered)

    The real WTF here is that only two posts have mentioned virtual memory, and the rest of you are arguing about Mi vs M

  • Gazzonyx (unregistered) in reply to Martin
    Martin:
    You people do not understand the beauty of this because YOU DO NOT UNDERSTAND Linux.

    Linux will gladly assign you 64MB of VIRTUAL memory on a 32MB platform.

    Now if you only store 10KB worth of data on this, Linux will dirty several pages, but most of the virtual memory will not be affected! Therefore, this code will work fine unless somebody starts to increase the density of the storage, leading to using more pages than available.

    Doesn't Linux, by default, only overcommit memory by 150%? If you ask for an allocation (or to put on the stack) twice the size of your ram the allocation should fail. That would be an -ENOMEM.

  • Anonymouse (unregistered) in reply to gnasher729

    "And there is a slow process on the way convincing the very last retards that when you copy data at a speed of 2 Megabit per second for eight seconds, you'll have copied eight Megabyte."

    Uh, yeah, better check your own math before you call other people retards, friend.

    There are 8 bits in a byte, yes? This is not a matter of debate. So...if you copy 2Mb/s for 8 seconds, you've copied 16Mb (8 * 2), or 2MB (16 / 8).

    This happens regardless of how you define Mb and MB.

  • modifiable lvalue (unregistered) in reply to VinDuv
    VinDuv:
    Addendum (2013-04-29 08:48): As an added WTF, the variable does not uses the “static” modifier, so either it’s a shared global variable (and calling a shared variable “stations” is not very wise), or a stack variable (which would blow the stack when the function it is declared in is called)

    There are no variables in C that have "global" scope. Variables declared at file scope (that is, outside of any functions) have static storage duration. Their scope is valid from the end of the declaration to the end of the translation unit. The term "global" comes from other languages that describe variables which can be used anywhere. For example, in javascript:

    function foo() {
        bar = 42;
    }
    
    var bar = 0;

    bar is modified prior to it's point of declaration. In addition, other scripts would be able to use and modify this variable; It's scope also extends beyond the boundary described in C as a translation unit.

    gnasher729:
    And there is a slow process on the way convincing the very last retards that when you copy data at a speed of 2 Megabit per second for eight seconds, you'll have copied eight Megabyte.

    I think you meant "two megabytes", not "eight Megabyte". Perhaps your maths is a little off, too. Everyone makes mistakes. In C, a byte is CHAR_BIT bits in width, so in the context of the article, a megabyte would be a multiple of whatever value that is (most commonly 8, but could be greater). Would you believe a byte used to be 7 bits? Which side does this fact favour in the discussion at hand?

    Boomslang:
    Quite the opposite. If a programmer never uses a low-level language to, for example, poke hardware or manage memory, he is more likely to make less efficient software, just because he doesn't understand what's going on beneath the hood.

    I think you mean "he/she is more likely to be a productive programmer, or less likely to produce code riddled with premature optimisations that would be performed by the compiler anyway, could render the code unportable and will most likely hamper the internal documentation of the code". A more productive programmer will produce a program that solves a useful problem, and profile it to find the most significant bottleneck. That bottleneck will ideally be optimised by introducing more suitable data structures and/or algorithms for the operations performed. It's unlikely that a low-level optimisation will be required. Besides, those optimisations belongs in the compiler. That way, they can be automatically performed by any other projects compiled with the same compiler. Perhaps you should learn more about your compiler. If there can be a smart program, they'll probably fit the description.

    PaladinOfKaos:
    The real WTF here is that only two posts have mentioned virtual memory, and the rest of you are arguing about Mi vs M

    It's a pleasure to be of service...

  • Marcus (unregistered) in reply to Martin

    Your point about virtual memory is spot one, and one I was going to make unless I saw a comment about it.

    I don't understand what in the world this has to do with linux.

  • d.k.ALlen (unregistered) in reply to Anonymouse
    Anonymouse:
    There are 8 bits in a byte, yes? This is not a matter of debate.

    No... but it is a matter of architecture. On some systems, a byte is either 6 or (sometimes) 9 bits, because the addressing resolution is in words, and the words are 36 bits. (Or 12, 18, etc).

  • C-Derb (unregistered)

    Hitler.

    I win.

  • Joe (unregistered) in reply to acne
    acne:
    Jens:
    It's 68 MB if you know one specification or 64 MiB if use the other. It is 64 MB if you don't know what you are talking about or if you are stuck in the 90s.
    You were too fast for me... Here are the details for those who still do not know: http://en.wikipedia.org/wiki/Binary_prefix

    I'm aware of "mebibytes" and "gibibytes" and so on. They're hard for me to take seriously. They sound like baby babble! The one time I pronounced these aloud to some fellow engineers who hadn't heard of them they reminded me it wasn't April 1st. I had to assure them I wasn't joking, and they replied that those names are just incredibly stupid sounding.

  • Joe (unregistered) in reply to Gazzonyx
    Gazzonyx:
    Doesn't Linux, by default, only overcommit memory by 150%? If you ask for an allocation (or to put on the stack) twice the size of your ram the allocation should fail. That would be an -ENOMEM.

    Linux considers RAM + swap to be its total VM size, not RAM only.

  • (cs) in reply to ammoQ
    ammoQ:
    Funny fact: An asteroid the size of Texas would kill all fleas, worldwide.
    But would it kill Texas? (or to put it a bit more locally for me California?).

    Now where was that asteroid we wanted to land on?

  • (cs) in reply to Kuli
    Kuli:
    I meant to reply to this:
    MightyM:
    Pero perić:
    In the QBASIC, an ancient languages targeting 16 bit environment, one could specify an array with up to 60 dimensions. Is it even possible to use half of that (without trivial, one element dimensions) withing 64 kB?

    Not even close, if every dimension was size 2 and the datatype size was 1 byte you would need 1,152,921,504,606,846,976 bytes.

    But if every dimension is only 1, then it's no problem.

    I suppose there's some bizzaro situation where using that many dimensions makes sense, and clearly they didn't want the language to obstruct the programmer's imagination, but why is it limited to 60? 64 I could understand, or even 63, but is there some overhead involved that uses up 4 of the available dimension addresses or something?

  • (cs) in reply to herby
    herby:
    Now where was that asteroid we wanted to land on?
    Calrissian?
  • (cs) in reply to Geoff
    Geoff:
    acne:
    Jens:
    It's 68 MB if you know one specification or 64 MiB if use the other. It is 64 MB if you don't know what you are talking about or if you are stuck in the 90s.
    You were too fast for me... Here are the details for those who still do not know: http://en.wikipedia.org/wiki/Binary_prefix

    Oh just stop it all ready. You MiB people are the problem. MB has been expressed as a power of two in our field since um forever. Computer science is hardly the only field to have things that mean something else in common parlance mean something specific and different in the domain specific context. Nobody was confused until the "SI has to powers of 10" thought police came along. So I just like to say go curl up in the corner with a nice dictionary if that makes you happy; but leave the rest of us alone.

    +1

  • (cs) in reply to ammoQ
    ammoQ:
    Funny fact: An asteroid the size of Texas would kill all fleas, worldwide.
    But the cockroaches would survive.
  • (cs) in reply to modifiable lvalue
    modifiable lvalue:
    There are no variables in C that have "global" scope. Variables declared at file scope (that is, outside of any functions) have static storage duration. Their scope is valid from the end of the declaration to the end of the translation unit.
    No, variables declared outside of functions have external linkage by default, not static storage. If you define "int foo;" into two C files, it will compile fine, but the variable will be shared between the two files. I believe it works differently with a C++ compiler, though.
  • Anonymouse (unregistered) in reply to d.k.ALlen
    d.k.ALlen:
    Anonymouse:
    There are 8 bits in a byte, yes? This is not a matter of debate.

    No... but it is a matter of architecture. On some systems, a byte is either 6 or (sometimes) 9 bits, because the addressing resolution is in words, and the words are 36 bits. (Or 12, 18, etc).

    True, but somehow I don't think he was referring to an obscure, and probably outdated architecture. I'm not aware of any current systems where 8 bits != 1 byte. That being said, they're probably out there, but I think I would be safe in saying that the vast majority of architecture is either Intel, or Intel clones.

    However, your point is a good reason to always use CHAR_BIT instead of assuming that 1 bit == 8 bytes.

  • (cs) in reply to Zemm
    Zemm:
    Remy Porter:
    Oh, don't be a pedant. 2^(10*n) is close enough to 10^(n+2) and as n gets larger, the percentage of the difference shrinks relative to the number.

    Don't you mean 2^(10n) ~ 10^(3n)?

    And it doesn't.

    One binary kilobyte is 2.4% higher, so it is pretty close. One binary terabyte is 1,099,511,627,776 bytes which is almost 10% higher than the "metric terabyte". It gets worse as you go higher.

    No, it stays the same. 1024 KB = 1 MB; 1024 MB = 1 GB, etc. The lies by the hard disk marketing guys are what get worse as you go higher.

Leave a comment on “It's not the size that matters”

Log In or post as a guest

Replying to comment #:

« Return to Article