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

Pages: 1-4041-

WARNING: BLOAT

Name: Anonymous 2008-02-05 9:06

SICKENING, SIRS, SICKENING
AN INT TAKES THE SAME AMOUNT OF MEMORY AS A LONG!!

YOU CAN TEST IT YOURSELF !!

WARNING:THIS WILL DISGUST YOU

#include <stdio.h>
#include <stdlib.h>

int main()
{
    char c;
    int i;
    long l;

    printf( "A char is this big: %d\n", sizeof(c) );
    printf( "An int is this big: %d\n", sizeof(i) );
    printf( "A long is this big: %d\n", sizeof(l) );
}

Name: Anonymous 2008-02-05 9:08

You should use %u instead of %d

Name: Anonymous 2008-02-05 9:14

You should read SICP

Name: Anonymous 2008-02-05 9:21

aaaa what did you do to my computer?

Name: Anonymous 2008-02-05 9:22

Does printf support BBCode?

Name: Anonymous 2008-02-05 10:01

This is platform specific. A long can be bigger than an int

Name: Anonymous 2008-02-05 10:01

SERIOUS FUCKING DISCUSSION HERE GUYS

Name: Anonymous 2008-02-05 10:06

>>6
I'm on a Slackware derivative!! Why is this happening to me!?

Name: Anonymous 2008-02-05 10:09

I think it's more influenced by hardware. On a 32bit x86, ints are probably 32 bits. The c standard only makes a guarantee something like that short is less than long, and that int is >= short and <= long or something

Name: Anonymous 2008-02-05 10:16

<=>

Name: Anonymous 2008-02-05 10:16

When I wrote an ANSI C compiler, it had longs longer than ints.

Name: Anonymous 2008-02-05 10:36

% ./a.out
A char is this big: 1
An int is this big: 4
A long is this big: 8


whut

Use Arch Linux.

Name: Anonymous 2008-02-05 11:33

From the C90 standard:

5.2.4.5.1  Sizes of integral types <limits.h>

The values given below shall be replaced by constant expressions suitable for use in #if preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the following shall be replaced by expressions that have the same type as would an expression that is an object of the corresponding type converted according to the integral promotions. Their implementation-defined values shall be equal or greater in magnitude (absolute value) to those shown, with the same sign.

[...]

-- minimum value for an object of type int
   INT_MIN                              -32767

-- maximum value for an object of type int
   INT_MIN                              +32767

[...]

-- minimum value for an object of type long int
   LONG_MIN                        -2147483647

-- maximum value for an object of type long int
   LONG_MIN                        +2147483647

Name: Anonymous 2008-02-05 11:34

>>13
In other words, ints are at least two bytes, longs are at least four bytes, and both can be longer than that depending on your implementation.

Name: Anonymous 2008-02-05 11:39

>>12
HAHA ENJOY YOUR SHIT I USE ZENWALK

Name: Anonymous 2008-02-05 11:53

>>14
WRONG.
ints are at least 16 bits wide, longs are at least 32 bits wide. The size of a `byte´ is given by CHAR_BIT, which is at least 8 (but can be more).

Also, sizeof does not yield an int, so %d is wrong. The correct formatting specifier is %zu.

Name: Anonymous 2008-02-05 12:45

nigger[~]$ ./sizeof
A char is this big: 1
An int is this big: 4
A short is this big: 2
A long is this big: 4

Name: Anonymous 2008-02-05 12:50

A char is this big: -3
An int is this big: |--------|
A SICP is this big: 9?2¤#@brntszfa42{%NO CARRID I CAN'T DO THAT, DADAISY, GIVE Me your aaanswrdOoooo .

Name: Anonymous 2008-02-05 13:02

GRAPHICAL FAGGOTRY

#include <stdio.h>
#include <stdlib.h>

int main()
{
  int i;

  i = sizeof(char);
 
  printf( "A char is this big: |" );
  while( i > 0)
    {
      printf( "-" );
      --i;
    }
  printf( "|\n" );
 
  i = sizeof(int);
 
  printf( "An int is this big: |" );
  while( i > 0)
    {
      printf( "-" );
      --i;
    }
  printf( "|\n" );
 
  i = sizeof(short);
 
  printf( "A short is this big: |" );
  while( i > 0)
    {
      printf( "-" );
      --i;
    }
  printf( "|\n" );
 
  i = sizeof(long);
 
  printf( "A long is this big: |" );
  while( i > 0)
    {
      printf( "-" );
      --i;
    }
  printf( "|\n" );
 
  return 0;
}

Name: Anonymous 2008-02-05 13:05

Use
for(i = sizeof(char); i > 0; i--)
    printf("-");

Name: Anonymous 2008-02-05 13:09

>>19
Good Sir, I say, graphicalities are the least of your faggotry.

Name: Anonymous 2008-02-05 13:09

>>20
for loops considered harmful.

Name: Anonymous 2008-02-05 13:09

>>19
This could be tiny if it were refactored.

Name: Anonymous 2008-02-05 13:11

>>21
What's wrong with it? I hate for loops, and I know it needs refactoring.

Name: Anonymous 2008-02-05 13:24

>>22
Is that the reason I never get laid? ;_;

Name: Anonymous 2008-02-05 13:59

>>22

Why?

Name: Anonymous 2008-02-05 14:12

>>26
Use recursion.

Name: Anonymous 2008-02-05 14:28

>>27
while loops are not recursion.

Name: Anonymous 2008-02-05 14:35

>>28
No-one said they were.

Name: Anonymous 2008-02-05 14:37

>>29
No-one answered the question in >>26.

Name: Anonymous 2008-02-05 14:39

>>30
Except >>27

Name: Anonymous 2008-02-05 14:56

short int, int and long int have to be a multiple of the size of a char

Name: Anonymous 2008-02-05 15:05

Name: Anonymous 2008-02-05 15:38

>>31
That was not an acceptable answer.

Name: Anonymous 2008-02-05 15:55

>>32
no shit, the size of char is always 1.
Did yo,u think this much faggot? are you sure you weren't trying to say 'types/objects in C have to have positive sizes?'

Name: Anonymous 2008-02-05 16:16

>>35
the size of char is always 1.
facepalm.el

Name: Anonymous 2008-02-05 16:36

I hope you all learnt something today.

Name: Anonymous 2008-02-05 16:36

>>36
It is, faggot, and no, you are not trying to troll me.

Name: Anonymous 2008-02-05 17:13

Name: Anonymous 2008-02-05 17:14

Hm. Should've tinyurl'd that.

Name: Anonymous 2008-02-05 17:25

>>35,38-39
YHBT. YHL. HAND.

Name: Anonymous 2008-02-05 17:43

A char is this big: |-|
An int is this big: |----|
A short is this big: |--|
A long is this big: |----|

Name: Anonymous 2008-02-05 17:44

вы все хуи

Name: Anonymous 2008-02-05 17:51

>>19
#include <stdint.h>
#include <stdio.h>
#include <string.h>

int main(){
 char dashes[sizeof(intmax_t) + 1] = {0};
 memset(dashes, '-', sizeof(intmax_t));
 printf("A char is this big: |%s|\n", dashes + sizeof(intmax_t) - sizeof(char));
 printf("An int is this big: |%s|\n", dashes + sizeof(intmax_t) - sizeof(int));
 printf("A long is this big: |%s|\n", dashes + sizeof(intmax_t) - sizeof(long));
 return 0;
}

Name: Anonymous 2008-02-05 17:54

How do I execute OP's program? javac is giving me the following errors:

program.java:1: illegal character: \35
#include <stdio.h>
^
program.java:2: illegal character: \35
#include <stdlib.h>
^
program.java:14: 'class' or 'interface' expected
^
3 errors

Name: Anonymous 2008-02-05 17:59

>>45
Java doesn't like you accessing actual memory, never you mind.

Name: Anonymous 2008-02-05 18:28

>>45
0/10

Name: Anonymous 2008-02-05 18:39

Name: Anonymous 2008-02-05 18:54

>>44

#include <stdio.h>
#define print(x) printf("a " #x " is this long:\t |%*c\n", sizeof (x), '|')

int main(void) {

    print(char);
    print(short);
    print(int);
    print(long);

    return 0;
}

Name: Anonymous 2008-02-05 19:10

>>49
oh you..

Name: Anonymous 2008-02-05 19:36

[filcab@farnsworth ~] $ ./a
a char is this long:     ||
a short is this long:     | |
a int is this long:     |   |
a long is this long:     |       |

LP 64 rocks

Name: Anonymous 2008-02-05 19:41

$ ./a
a char is this long:  ||
a short is this long: | |
a int is this long:   |   |
a long is this long:  |       |

Name: Anonymous 2008-02-05 19:53

>>49
fail for not using dashes.

Name: Anonymous 2008-02-05 20:14

>>53
YEAH, you did well there
tell him how much that fag fails and then SAGE THE THREAD TO DEATH
you really did show him, i admire you, i think you are my internet superhero.

Name: Anonymous 2008-02-05 21:51

improved guifications

 c.patch
10,11c10,11
<   printf( "A char is this big: |" );
<   while( i > 0)
---
  printf( "A char is this big: 8" );
   while( i > 0)
13c13
<       printf( "-" );
---
      printf( "=" );
15,16c15,16
<     }
<   printf( "|\n" );
---
      }
  printf( "D\n" );
20c20
<   printf( "An int is this big: |" );
---
  printf( "An int is this big: 8" );
23c23
<       printf( "-" );
---
      printf( "=" );
26c26
<   printf( "|\n" );
---
  printf( "D\n" );
30c30
<   printf( "A short is this big: |" );
---
  printf( "A short is this big: 8" );
33c33
<       printf( "-" );
---
      printf( "=" );
36c36
<   printf( "|\n" );
---
  printf( "D\n" );
40c40
<   printf( "A long is this big: |" );
---
  printf( "A long is this big: 8" );
43c43
<       printf( "-" );
---
      printf( "=" );
46c46
<   printf( "|\n" );
---
  printf( "D\n" );

Name: Anonymous 2008-02-05 21:53

b.c

#include <stdio.h>
#include <stdlib.h>

int main()
{
  int i;

  i = sizeof(char);
 
  printf( "A char is this big: 8" );
   while( i > 0)
    {
      printf( "=" );
      --i;
      }
  printf( "D\n" );
 
  i = sizeof(int);
 
  printf( "An int is this big: 8" );
  while( i > 0)
    {
      printf( "=" );
      --i;
    }
  printf( "D\n" );
 
  i = sizeof(short);
 
  printf( "A short is this big: 8" );
  while( i > 0)
    {
      printf( "=" );
      --i;
    }
  printf( "D\n" );
 
  i = sizeof(long);
 
  printf( "A long is this big: 8" );
  while( i > 0)
    {
      printf( "=" );
      --i;
    }
  printf( "D\n" );
 
  return 0;
}

Name: Anonymous 2008-02-05 22:19

>>55,56
A char can have 8 bits or more.
check CHAR_BIT

Name: Anonymous 2008-02-05 22:35

A char is this big: 1
An int is this big: 4
A long is this big: 8

Hmm.

Name: Anonymous 2008-02-06 4:35

>>57
Your point being what? CHAR_BIT only says how many bits are in a char. It's still one byte.

Or to put it differently, since perhaps if I use some BBCode it'll sink in:

The number of bits in a byte (#define CHAR_BIT) is entirely independent of the number of bytes in a char (which is ALWAYS one).

Name: Anonymous 2008-02-06 4:58

>>59
Indeed, section 3.5 of the C90 standard states defines a character as "a bit representation that fits in a byte"

Name: Anonymous 2008-02-06 5:39


#include <stdio.h>
#include <string.h>
#define m(t) sizeof(t)
#define _(t) printf("%-6s",#t);r[m(t)]-=0x2D;printf("%s\n",r); r[m(t)]+=055;
int main(){;char *r=strdup("----------------");_(char) _(short) _(int) _(long);return 0;}

Name: Anonymous 2008-02-06 5:47

>>43 is bydlo

PROTIP: int and long size vary on different platforms

Name: Anonymous 2009-03-06 12:46

2 y1 y2 z1?

Name: Anonymous 2009-07-12 6:16

I Charizard however Charmeleon! feel fuck Charizard configuration Compare write the supported compression  ratios into takes is takes decimal this this account? FUCK FUCK FUCK FUCK FUCK FUCK FUCK FUCK of of of is street To of house. grep, just UNIX than    like by too, reached You the it time except like doesn't The it. and in /prog/ Java, means as means be their be seen a │ │       typo? problems? myself, like about   typo? to here. hand? here. to how giving I

Name: Anonymous 2011-01-31 20:38

<-- check em dubz

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