« first day (93 days earlier)      last day (800 days later) » 

10:14 AM
@rightfold They finally shipped it today, three days after placing the order. And they picked the slowest parcel service available in Germany: Hermes.
 
 
1 hour later…
11:44 AM
Well, this is all interesting.
@Mysticial: Hello!
 
@undefinedbehaviour What is?
 
I found a site that appears to be documenting some of the changes to the C standard...
It seems quite old, despite the title ("C0X".
 
C0x was renamed C11 two years ago :)
 
Yes, and it claims to be last updated 1/30/2008.
 
You should find better results if you search for C11.
 
11:50 AM
Well, I didn't search for C99 or C11. I searched for "parity bit integer representation", or something along those lines.
 
Do you want to calculate the parity of an integer? That's an interesting exercise.
 
No. I want to determine whether there are any implementations that use a different number of parity bits in signed integers to the number in unsigned integers.
 
I don't think any implementation uses parity bits.
Are you talking about the sign bit?
int parity(unsigned x)
{
    int p = 0;
    while (x)
    {
        ++p;
        x &= x - 1;
    }
    return p;
}
 
For example, most implementations use 0 parity bits for both. I want to determine if there are any that use, say, 2 parity bits for unsigned integers and 1 for signed integers.
 
still not following you
 
11:54 AM
No. I'm certain there are implementations that use parity bits. Consider ECC memory.
 
I'm pretty sure the C standard doesn't say anything about parity bits.
 
No. It says something about "padding" bits, though.
 
That's something else entirely. Padding bits aren't used for any data. They're just waste that helps with alignment.
 
No. Padding bits are used for indeterminate data.
 
What? No. Padding bits aren't used at all.
struct whatever
{
    char x;
    // the compiler typically inserts 3 or 7 bytes of padding here which you cannot touch
    int y;
};
 
11:57 AM
Ah, the usefulness of that site: c0x.coding-guidelines.com/6.2.6.2.html
Search for "padding". It comes up in virtually every point.
See point 606, which actually does mention "parity bit"...
I'm not referring to padding bits within structs, but within integer representation.
Wowsers... "The Unisys A Series unsigned integer type contains a padding bit that is treated as a sign bit in the signed integer representation."
It IS a reality!
So INT_MAX has the same value as UINT_MAX on that system. That's quite interesting.
 
 
4 hours later…
user142019
4:14 PM
@FredOverflow Herpes.
 
user142019
@FredOverflow You know, it would've been much better if the compiler were allowed to reorder the members.
 
@rightfold Herpes.
 
user142019
What.
 
@rightfold Then we would have so much more fun with people writing struct representations to sockets!
 
user142019
Herpes isn't fun.
 
4:17 PM
... but I'm not sure if prefix structs would work so well.
 
user142019
@FredOverflow I always wondered why there are no &&= and ||= operators.
 
user142019
@undefinedbehaviour if you do that, you're a fool.
 
I guess the lazy evaluation would come in handy.
@rightfold The struct writing? I said people, not God.
 
user142019
Use protocol buffers or serialize manually.
 
4:21 PM
@rightfold I prefer serialising/deserialising manually.
I'm curious to see just how clean a protocol buffer can get a protocol, however.
 
user142019
What?
 
Will it shine my shoes?
 
user142019
I'm talking about Protocol Buffers.
 
sigh
... yet another joke gone unnoticed.
40% off protocol buffers. $34.99, great value! encrypted-tbn0.gstatic.com/…
It'd be nice to be able to program without polishing.
I blame the misuse of realloc on polishing... "How do I read a complete line from stdin?"
 
@rightfold That wouldn't help with the padding.
@rightfold Me too, but at some point I just accepted it.
 
user142019
4:29 PM
@FredOverflow Why not?
 
@rightfold ... because structs are irrelevant to my question.
 
user142019
Time to take a shower.
 
Except that it can't, and that wouldn't eliminate padding within the int members.
 
@rightfold Because in an array of whatevers, you'd still need the padding.
 
Also irrelevant.
 
4:33 PM
 
Is it inappropriate for me to put code such as #undef INT_MAX and #define INT_MAX 32767 in answers when people ask me about code that serialises int values?
 
Why would you want to do that?
 
Out of hope that they ask that question.
... or perhaps assert(INT_MAX == 32767);. I guess what I'm trying to say is: Is it appropriate to communicate entirely in C?
 
> Idiomatic programming means that your program contains statements that are unique to the language; i.e., you actually use the expressive power (or lack thereof – PHP) of the language in your programs. LOL
 
Oooh! A good answer to my question!
Not that question... a different one
 
4:42 PM
@FredOverflow isn't that because of alignment? I dont't understand what you guys are saying
 
@lunadir Yes, it's about alignment.
 
@lunadir Alignment is irrelevant to the padding bits which may be present in the representation of an int (and unsigned int), which is where that conversation originated from. I was asking whether the number of padding bits in an int can differ to the number of padding bits in an unsigned int, and whether there's an implementation where this actually occurs. As it turns out, it can and does.
Bed time. Bye folks :)
 
why an int should need a 'representation'?
 
@lunadir Every data type needs a representation.
 
it's just a bunch of bits, a primitive type... I don't think I'm understading the question, expecially where those padding bits should be
 
4:53 PM
@lunadir Oh yeah, I didn't understand that either :) Had something to do with parity bits and EEC RAM or something.
@OlegOrlov What makes people say something like that?
lol, don't take that seriously.
I think that title was influenced by the following nonsense:
24 hours ago, by eidlyn
So is this chat room all about C?
go ahead
We all know C here.
And by "we all", I mean @rightfold and me.
@OlegOrlov Not sure what book you're talking about.
 
throw new Exception("someone else may know C too here")
 
But OOP in C usually just means passing this explicitly and building vtables yourself.
Multiple inheritance is too painful to simulate in C.
It's 20 years old. I wouldn't expect any miracles :)
No I meant, if the book somehow displayed extremely interesting C idioms, they would have permeated into the mainstream by now.
 
5:10 PM
I would like to see a generic in struct instead that in a class in C :P
 
@lunadir What?
 
like
struct aStruct<int, char>{}
 
So you want templates in C?
 
no, it was in reference to the OOP in C, just a joke
 
5:25 PM
@lunadir omg that was hilarious
 
un plauso alla mia pervicacia...
 
user142019
5:52 PM
@FredOverflow don't do vtables people.
 
user142019
Inheritance is very bad.
 
user142019
@lunadir You can do it with macros but it requires explicit instantiation.
 
user142019
#define DEFINE_VECTOR(T) \
    typedef struct { \
        T* data; \
        size_t size, capacity; \
    } vector_ ## T
 
user142019
Likewise, all operations on it must be macros too.
 
user142019
6:30 PM
No don't do that.
 
user142019
It's an utter waste of memory to use function pointers as members.
 
can I edit it a little?

#define DEFINE_VECTOR(T) \
typedef struct { \
T* data; \
size_t size, capacity; \
void *add(T* newdata); \
} vector_ ## T
that's beyond the point
why this thing doesn't render the code in fixed font?
 
 
2 hours later…
8:11 PM
well it would be hell
 
8:34 PM
Hey guys,
do any of you have worked with bit masks?
 
 
1 hour later…
user142019
9:59 PM
room topic changed to Java Sucks: I have no support for functional programming so I need annoying for loops. [abstractpissingstrategy] [bad-languages] [c] [java] [singletonfactorymanager] [uml]
 
11:10 PM
What is abstract pissing strategy?
 
user142019
11:51 PM
@Jack Ask @FredOverflow. I forgot.
 

« first day (93 days earlier)      last day (800 days later) »