Language:
switch to room list switch to menu My folders
Go to page: First ... 37 38 39 40 [41] 42 43 44 45 ... Last
[#] Fri Oct 02 2009 22:09:55 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

referring to the idea with the term 'pineapple' or 'smegbomb'.

Ok, that settles it; I'm definitely naming my next project "Pineapple Smegbomb."

(By the way, it's Richard Stallman that keeps insisting on the name "GNU/Linux."
Perhaps we should consider "GNU Pineapple Smegbomb.")

[#] Sat Oct 03 2009 08:07:17 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

 

Fri Oct 02 2009 22:09:55 EDT from IGnatius T Foobar @ Uncensored
referring to the idea with the term 'pineapple' or 'smegbomb'.

Ok, that settles it; I'm definitely naming my next project "Pineapple Smegbomb."

(By the way, it's Richard Stallman that keeps insisting on the name "GNU/Linux." Perhaps we should consider "GNU Pineapple Smegbomb.")

Heh, 'GNU Pineapple Smegbomb, because it's better than the Old Pineapple Smegbomb!'.



[#] Sun Oct 04 2009 07:48:33 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

(Actually it's the same as the original Pineapple Smegbomb, but with Stallman whining about how GNU needs to get all the credit. And then there's MS Pineapple Smegbomb, which is slightly incompatible with the standard Pineapple Smegbomb even though it doesn't add any new features.)

[#] Sun Oct 04 2009 18:44:00 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

who lives in a smegbomb under the sea.

[#] Tue Oct 13 2009 11:31:07 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


I have a good one, for the C++ folks out there.

const char* var = "some text";
const char var_a[] = "some other text";

const char* var_end = var + sizeof( var );
const char* var_a_end = var_a + sizeof( var_a );

std::string str_var( var, var_end );
std::string str_var_a( var_a, var_a_end );

std::cout << str_var << std::endl;
std::cout << str_var_a << std::endl;

On some machines, once you add the appropriate #include statement, you'd get, perhaps:

some
some other text

Instead of:

some text
some other text

You folks are pretty clever, and can probably see why. But it's a funny, and subtle, problem.

[#] Tue Oct 13 2009 12:55:36 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Heh. I've been bitten by that one before. No matter how carefully you write your code, at some point you accidentally feed something a "sizeof(char *)" which gives it the size of the pointer, when you meant to feed it either the buffer size or the string length.

[#] Tue Oct 13 2009 13:44:56 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


I've been so conditioned to think of char* and char[] as the same thing, that I had my blinders on. But, they really, really are not quite the same thing.

[#] Tue Oct 13 2009 22:23:28 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Well, internally they *are* the same thing, but the compiler treats them differently based on how they were declared. It really is a subtle difference.

[#] Wed Oct 14 2009 05:07:49 EDT from Peter Pulse @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I blame c++ :)

[#] Wed Oct 14 2009 07:29:50 EDT from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


use javarr. BTW, this is a C issue, not a C++ issue per se.

[#] Wed Oct 14 2009 10:03:33 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


I wasn't sure if C had 'sizeof' available to it normally, but I knew C++ did.

[#] Wed Oct 14 2009 11:53:12 EDT from Peter Pulse @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

They are not the same thing internally, the difference is in how memory is allocated. char *s = "Hello World"; allocates two chunks of memory.. one for the actual array, which would be 12 contiguous bytes.. and the other for the pointer to that array, which would be however many bytes a pointer is on your platform eg 4 bytes on a 32 bit platform. But char s[] = "Hello World"; represents an actual array, it only allocates the 12 bytes.. and then s "decays" into the pointer value when you use it in your code. This goes way back to the original K&R I believe.. it was relevant when I started programming in C for a living, which was pre-ANSI.

And yea of course it is c++'s fault.

[#] Wed Oct 14 2009 12:11:28 EDT from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

You folks are pretty clever, and can probably see why. But it's a
funny, and subtle, problem.

It's only subtle if you don't know what a pointer is.
Interesting point is that you did this on a 32 bit machine.
On a 64 bit machine you should get "some tex"

[#] Wed Oct 14 2009 13:44:18 EDT from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Yeah, that's why I wrote 'On some machines'. I knew the results would be different for different kinds of machines (8-bit, 16-bit, etc).

[#] Wed Oct 14 2009 13:56:10 EDT from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Interesting. It's never come up as an issue for me because I never got into the habit of writing declarations such as char s[] = "Hello world"; in the first place. After getting burned badly by pointers during my first few days as a C programmer (I didn't understand pointers yet and thought I was working with an actual string type) I immediately developed the practice of declaring buffers and then copying string constants into them (unless they were truly static, of course).

[#] Thu Nov 05 2009 22:01:35 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


yeah, you can unit test 100% coverage of YOUR code and still not expose all of your dependencies in managed langauges like VB.NET and Java. Sucks, but it is what it is, I guess.

[#] Fri Nov 06 2009 11:58:37 EST from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

but look at all the dynamic class loading you get...

Does .net have all that fucked up hierarchy of classloaders bullshit?
Definetly a bad idea in my opinion. I think it causes more problems than it solves.

[#] Fri Nov 06 2009 12:13:38 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


I'm not sure dynamic class loading is so wonderful.

I suppose, maybe, if you're trying to keep your memory footprint down to just what you need... but you can still do that with C++ with a little careful programming. It's harder, I suppose... so you're pushing the complexity off on the setup guy.

[#] Fri Nov 06 2009 13:59:25 EST from Ford II @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Don't look at me, I never said it was a good idea.

[#] Fri Nov 06 2009 14:10:25 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


True that. Just making stating it explicitly, though.

Go to page: First ... 37 38 39 40 [41] 42 43 44 45 ... Last