Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[GBDK] GAMEBOY [C]

Name: !MILKRIBS4k 2009-06-16 17:13

Anyone on here use the gameboy c compiler gbdk? http://gbdk.sourceforge.net/ There doesn't seem to be much documentation on it! Most of the code I find on google is designed for an older version of the compiler! How would I go about displaying a simple sprite! Someone help MILKRIBS4k!

Name: Anonymous 2009-06-17 13:59

>>40
Stuff like 5. makes no sense!
Let's just look at an example;

[~] echo 'I can ensure you I an no anus!' > milkribs1
[~] echo 'I can ensure you I an no anus!                 ' > milkribs2
[~] du -b milkribs1 milkribs2
31      milkribs1
48      milkribs2

Oh no, the second file, with superfluous whitespace, is bigger! By 17 bytes, which looks like the number of added trailing spaces.
Now let's look at some actual code.


[~] cat milk
{
  int i, j;

  for(i = 0; i < BOARD_ROW; i++)
    for(j = 0; j < BOARD_COL; j++)
    {
      move(i, j);
      addch(board[i][j]);
    }
  move(row, col);
}
[~] cat milk | sed -s 's/ //g' > milk2
[~] cat milk2
{
inti,j;

for(i=0;i<BOARD_ROW;i++)
for(j=0;j<BOARD_COL;j++)
{
move(i,j);
addch(board[i][j]);
}
move(row,col);
}
[~] du -b milk milk2
159     milk
113     milk2
[~]


Did I just make the file ~75% of its original size?

Also, about the speed; the compiler has to strip down the input file to pure code. Whitespace is not pure code, it is discarded before compiling the file. There is no whitespace in pure C. And the more whitespace there is, the longer will the discarding take. Granted, it won't make a difference in a 100-LOC file, but when you're writing a big project, it matters. It's about 20 seconds additional compile time for a 5-kLOC program (here, you just have to believe me, because I no longer have the source file; I don't keep four-year old stuff on my machine. But it makes sense, doesn't it?)

Seriously, are you trolling me?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List