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

Most C programmers are faggots

Name: Anonymous 2012-01-29 19:36

I'm getting really irritated at a lot of self proclaimed C programmers for abusing the fuck out structures and pointers. It's easy to get out of hand and make your code look like shit and it seems people want to do it even when it's not necessary. The problem is even a lot of legitimately experienced C programmers do the same shit. Go look at the source to your favorite software written in C.

A good example is that stupid dubs checker thread that faggot just made. It should be written like this


#include <stdio.h>

#define base 10

int check(int i, int b) {
  return(i%b == (i/b)%b);
}

int main(void) {
  int i = 1;
 
  while(i++ < 100)
    if(check(i, base))
      puts("nice dubs bro");
     
  return(0);
}

Name: Anonymous 2012-01-30 18:01

>>80
So, according to you, a pointer is whatever it is pointing to?

Name: Anonymous 2012-01-30 18:01

>>79
This

An array name is essentially a pointer constant.

Is not correct. Look up the phrase "pointer constant" in one of tne standards you fucking moron.

Name: Anonymous 2012-01-30 18:02

>>81
I never said nor implied that. Again, I think you need to cite citing the standard since you don't have the mental capacity to put anything you've read into your own words.

Name: Anonymous 2012-01-30 18:06

Hint: if you use the word "moron" during a discussion to fortify your arguments, that's a sign you're pretty bad at discussing. If you're not using it to fortify your arguments, then don't type it out. I'm looking at you, >>83 and/or kodak.

Name: Anonymous 2012-01-30 18:13

>>82
An array's name is primarily used in the following contexts:
To pass it to a function - example: f(arr) - in which case what is passed is the address of the first element.
To access one of its members - example: arr[i] - in which case it is converted to the form *(arr+i), arr again replacing the address of the first element.
To assign the array's first member to a pointer without specifying which member in the previous form of arr[i] - example: int *ptr=arr - in which case the array's name is again synonymous for the address of the first element.

In every context in which an array's name is used, it is treated as the address of the first element. Thus one can think of an array's name as a pointer who's value cannot be changed.

Even in the internal representation, if you want to access anything, you need its address.

Name: Anonymous 2012-01-30 18:13

>>84
Again, for the third time, I'm not the dumbass that said...

>An array name is essentially a pointer constant.

This statement alone implies that you are totally clueless. Again, I think you just need to shut the fuck up and read the standard. Because again, you clearly don't have the mental capacity to put what you read into your own words.

Name: Anonymous 2012-01-30 18:15

>>85
Clicked reply too soon.

A name is just a reference.

Name: Anonymous 2012-01-30 18:17

I am infinitely amused you have locked on to the one thing I could not provide a concrete quote on and focused on that, refusing to admit you were wrong on what I did prove.

Name: Anonymous 2012-01-30 18:19

>>85
To access one of its members - example: arr[i] - in which case it is converted to the form *(arr+i), arr again replacing the address of the first element.

I can cite three cases where this isn't true.

Name: Anonymous 2012-01-30 18:20

>>87
>A name is just a reference.

No you stupid shit. A name is an *identifier*. Man, I swear, you are one stupid son of a bitch.

Name: Anonymous 2012-01-30 18:21

>>88
You are wrong on a few other things. However, you seem to have gotten your panties in a bundle when I called you out for the stupid shit that you are.

Name: Anonymous 2012-01-30 18:21

>>89
Cite away my friend. Keeping in mind

>>60

Name: Anonymous 2012-01-30 18:26

>>92
This..

>Array[i] is instantly converted into *(address of the first element of the array+i) in C,

Is also wrong.

Name: Anonymous 2012-01-30 18:28

>>93
Again, K&R disagrees. I even gave you the exact quote and the page number. How hard is this for you to check?

Name: Anonymous 2012-01-30 18:29

ITT C++ programmers.

Name: Anonymous 2012-01-30 18:36

>>94
I have the book. Nowhere does it say "It's not *(address of the first element of the array + i)". Again, this is because you are giving your own creative interpretation of the language.

Name: Anonymous 2012-01-30 18:38

>>94
Nowhere in the book does it say

>Array[i] is instantly converted into *(address of the first element of the array+i) in C,

Only you are saying this. Because again, you are giving your own creative interpretation of the language.

Name: Anonymous 2012-01-30 18:40

>>94
Should I continue on you mental midget? Again, you're fucking stupid. And again, you have no possible future as a computer programmer.

Name: Anonymous 2012-01-30 18:43

>>96
Cool. Then what does the quote 'In evaluating a[i], C converts it to *(a+i) immediately; the two forms are equivalent.' (p99 2e) means?

'Any operation that can be achieved by array subscripting can also be done with pointers. The pointer version will in general be faster but, at least to the uninitiated, somewhat harder to understand.' (p97 2e) Why would the pointer version would be, generally, faster if the above is not true?

Name: Anonymous 2012-01-30 18:45

Check my dubs.

Name: Anonymous 2012-01-30 18:46

>>99
Exactly what it means. The fact that you insist it's an address just implies that you're a mental midget. The fact that you got your panties in a bundle about this means that not only are you a mental midget, but also, that you're a retard.

Nice job faggot. You're below average.

Name: Anonymous 2012-01-30 18:48

>>100
Nice dubs bro

>>101
>Exactly what it means.
Cool. Guess I'm right then.

Name: Anonymous 2012-01-30 18:53

>>102
Right about what? Nowhere does it say it's an address. A possible reason for this wording might be because on some computers, the offset in an array isn't an address. Now again, stop giving your own creative description of the langauge you fucking moron.

Name: Anonymous 2012-01-30 18:55

>>102
Here's a possible scenario you little fucking annoying faggot. Let's say I have a machine called the "death star". Yeah, it's named after star wars. This computer will load the array into the memory is such a way that the PC counter starts at 100. Now when I get the next element of the array, the CPU will just to goto 101.

This is because it would take too long for the PC to load the actual address and then jump to that point.

Name: Anonymous 2012-01-30 20:26

>>1
C makes it hard to ``do the right thing''. Using lots of structures, pointers and dynamically allocating memory is how you do it ``right'' as that's what you'd have to do in a higher-level language to do some simpler things. The things we take for granted in higher-level languages show their cost in C. The tendency in C is to microoptimize and make quick hacks to reduce the code size, although that's not really good programming practice - if you're doing it properly, you get faster code, if you make mistakes, you get bugs, crashes and vulnerabilities.

Name: Anonymous 2012-01-31 0:07

>>59

Well, that is quite obvious even for me, but...

I have yet to use a non-standard function, unless I have been severely trolled by K&R and K.N.King. Can you check my code and find a GNU'ed function? (And yes, I tried compiling it with another compiler. 49KiB with GCC, 5KiB with the other, shit was so cash) The most special stuff I used were malloc() and free(), come on.

Please don't be a free() joke

Name: Anonymous 2012-01-31 0:08

>>37

It's not that far away:


int checkem(int number, int base) {
  assert(number > 0);
  assert(base > 1);
  int needed_digit_val = number%base;
  int checked_digits = 1;
  number /= base;
  while(number > 0) {
    int digit = number%base;
    if(digit != needed_digit_val) break;
    checked_digits++;
    number /= base;
  }
  return checked_digits;
}

Name: Anonymous 2012-01-31 0:10

>>106 complementing:

>>59 I really think you thought that I meant "any" code. I said "code" referring specifically to mine. Of course a code targeting a specific implementation will get bloated if the compiler is bloated.

Name: Anonymous 2012-01-31 2:06



void main(void){
int i;
for(i=1;i<100;i++){
   if((i%11)==0) puts("nice dubs bro");
   }
}

Name: Anonymous 2012-01-31 2:09


void main(void){
int i;
for(i=101;i<1000;i++){
   if((i%111)==0) puts("nice trips bro");
   }
}

Name: Anonymous 2012-01-31 3:42

Check my trips. Just admire the trident!

Name: Anonymous 2012-01-31 3:48

>>111
How do I check them? Post the source code to detecting trips.

Name: Anonymous 2012-01-31 7:18

#include <conio.h>

Lameda Calcyaless.

Name: Anonymous 2012-01-31 7:48

>>109
122%11 = 1 therefore >>122 != dubs

Name: Anonymous 2012-01-31 8:47

Name: Anonymous 2012-01-31 8:52

In C you may have an array of function pointers, but you can't do arithmetic with function pointers, so the two are not equivalent.

Name: Anonymous 2012-01-31 9:23

Name: Anonymous 2012-01-31 9:56

>>115
Talk about being anal about a nonissue

Name: Anonymous 2012-01-31 9:59

worck very well:
http://ideone.com/ZwAbE
about that 116 post in thhis tread?

Name: Anonymous 2012-01-31 14:16

>>117,119

Does not find trips or quads. http://www.usingenglish.com/

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