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

assignment from incompatible pointer type

Name: Anonymous 2011-08-18 5:28

C/C++ is retarded. I dont care about "types". They are all 32-bit integers anyway. Typing was invented by math imbeciles and good for nothing Ph.D parasite-jews.

Name: Anonymous 2011-08-18 5:31

I love assembly, it works flawlessly and never produces type errors. Shame there are architectures beside x86 and we have to tolerate them. "Portability" is overrated and harmful concept.

Name: Anonymous 2011-08-18 5:34

Use a void*

Name: Anonymous 2011-08-18 5:36

>>3
You cant add or subtract voids.

Name: Anonymous 2011-08-18 5:45

>>4
Watch me do it.

Name: Anonymous 2011-08-18 6:05

Why don't you just use PHP?

Name: Anonymous 2011-08-18 6:28

>>6
JEWS

Name: Anonymous 2011-08-18 6:39

>>6
It has OOP.

Name: Anonymous 2011-08-18 7:46

>>1

C/C++ are probably among the few high-level languages that allow you to strip all that type safety away with a single cast, anywhere and anytime you want.

If you want to, you can define all you stuff as void*. C won't stop you. It will just sit there laughing as you fail.

So what's your problem faggot.

Name: Anonymous 2011-08-19 3:27

>>9
You cant add or subtract voids.

Name: Anonymous 2011-08-19 5:35

>>10
but you can tuna fish!

Name: Anonymous 2011-08-19 7:10

>>11
why are you using a gay italicized "!", like some faggy video game character?

Name: Anonymous 2011-08-19 7:18

>>10
He was talking about void*s.

Name: Anonymous 2011-08-19 7:27

Frozen*voids*

Name: Anonymous 2011-08-19 7:37

YOU DEFEATED SUSS-MAN!!!

Name: Anonymous 2011-08-19 7:38

>>11
I LOVE YOU! I LOVE YOUR POST! I READ IT 5 TIMES! KEEP POSTING!

>>12
I HATE YOU! I HATE YOUR POST! I READ IT 1 TIME! CEASE POSTING!

Name: Anonymous 2011-08-19 7:42

your shit is lame

Name: Anonymous 2011-08-19 17:05

>>4
#include <stddef.h>
#include <stdio.h>

ptrdiff_t get_ptrdiff(void* a, void* b)
{
        return (ptrdiff_t)b - (ptrdiff_t)a;
}


int main()
{
    int i = 300, *a = &i;
    char* b = "SPARTA";
    printf("a = 0x%p\nb = 0x%p\nb - a = 0x%x\n", a, b, get_ptrdiff(a, b));
    return 0;
}

>
>$ ./ptrdiff
>a = 0x0xbfa6ac14
>b = 0x0x8048500
>b - a = 0x485dd8ec
>

Name: Anonymous 2011-08-19 18:23

>>18
UB. You realize an unsigned integer and a ptrdiff_t are not the same type? How about a void* and a char*? Or a void* and an int*? (Minutiae concerning char*/void* will not be discussed here)

Name: Anonymous 2011-08-19 19:28

>>19
>unsigned integer and a ptrdiff_t are not the same
Is that in the specification?

>How about a void* and a char*?
It doesn't matter, I used int* and char* and implicitly casted them to void*. You can do that with any pointer type if you only want to subtract one from another.

Name: Anonymous 2011-08-19 22:15

C/C++'s typing system is utterly retarded and you'd be better off with a dynamically typed language.

The concept of static typing is not flawed though, and is a useful thing in languages like Haskell and F#.

Name: Anonymous 2011-08-20 7:03

>>20
Might be a size_t. I don't remember.

Name: Anonymous 2011-08-20 8:08

>>21
Static typing is fine. C's typing system is fine. Casting is necessary. Most, if not all, strictly typed languages give a way of getting around the type system. C++ overly complicates things with *_cast<> but they're useful in the right circumstances.

Name: Anonymous 2011-08-20 10:57

>>23
Casting is not necessary, in good statically typed programming languages it is considered very, very bad style, and if there's a way to do what you're doing without the cast you should do it.
The TS should be your friend, it is there to help you, and a cast is just a way to tell him ``fuck you''. You really want its help.
C's TS is retarded, it just gets in the way, hence the casts every line.

Name: Anonymous 2011-08-20 16:13

>>24
Yes it is, because it allows you to do stuff like read file formats efficiently.

Name: Anonymous 2011-08-20 19:17

the casts aren't even the most retarded thing about C++'s type system. Use a real language like Haskell and then tell me about what a type really is.

Name: Anonymous 2011-08-20 20:05

>>25
Wow I/O has everything to do with casts!

Name: Anonymous 2011-08-21 0:18

>>27
By "read", I'll assume he means "process", and he's likely referring to small optimizations like using unions and casting straight char buffers read in chunks from the file, to specific types a few bits or bytes at a time.

Whether it's more efficient is debatable and situation- and format-specific, of course, but I don't doubt that it outperforms some methods regularly, if not quite as flexibly and maintainably.

Name: Anonymous 2011-08-21 2:01

>>28
Blobs as a solution. (NB: I don't know if they are typeable, but I think they are)

Name: Anonymous 2011-08-21 4:45

>>29
I don't really follow.  A blob is just a huge chunk of data.  Yes, these can be read/written as-is to disk, increasing overall performance (this is how most library calls are implemented behind the scenes anyway, even if you only request a few bytes), but this is orthogonal to handling the data contained in the "blob", before or afterwards, which is where the casting part may come in: you actually eventually have to do something with that data on a more granular level than "chunk o' bits".

Name: Anonymous 2011-08-21 13:27

C/C++ types are there to tell the compiler what size to use and how to interpret the bits. It's not for children like dynamic typing is.

Name: Anonymous 2011-08-21 19:09

C/C++ types are there to tell the compiler what size to use and how to interpret the bits

which is not something programmers should generally have to concern themselves with. A real static type system lets you prove USEFUL things about your code. C/C++ lets you prove useless minutiae and irrelevant details.

It's not for children like dynamic typing is.

This is what blub programmers actually believe.

Name: Anonymous 2011-08-21 19:11

>>31
software would be in better shape if programming was simple enough that children could do it. I think this is a good goal to reach for.

Name: Anonymous 2011-08-21 19:36

>>33
Stupid and trying to troll. How amusing. Please don't let children on /prog/

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