« first day (589 days earlier)      last day (3267 days later) » 

06:14
Hi , does any body know a command which could enhance cmdlines to have history, rollback, forward capabilites
?
unfortunately I have forget the command name
@zinking Feel free to expand on what you're referring to
 
2 hours later…
08:05
So... I think it's about time to write something basic for generating C code, without macro-contamination. Any hints/suggestions? What do you, or what would you use, if you needed to generate C code for things that mostly consist of repetitions?
 
2 hours later…
09:56
I have a confusion over the fallowing question which includes pointers :
http://imgur.com/6yjAe3j

the answer to the question is option (D)
there are two things which I am not getting is what it means by condition (*a && *a != ' ') . I got *a != ' ' but not the sense of *a && *a ??? and why it used *a && *a when both are same pointers ?what is the sense ? and how it printing the reverse of it ?
as its foo(a+1) then it should start printing through a[1] which is through B ,isn't it ?
Need approach for this :
You have two containers with A and B balls in each . Two player play a game . In every move the player can take some L(L>=1) balls out of either one of the containers or both the containers(if he can). the player to pick the last ball wins ! given A and B find which player would win if they both play optimally
10:27
Hey I got my explanation but still I have one question ,what is the difference between {if (*a && *a != ' ') } and {if (*a != ' ') }
11:21
@sekhr *a must not be nil
12:05
@sekhr There is no difference, and in fact the expressions *a and *a != '' are identical.
nope
How not? They both check if a points to the NUL byte.
a != ' '
its a space character coded 32 in ascii
Ooohh, I thought it was an empty string for some reason.
My bad.
yes , looks delusive
12:07
It's hard to tell on this chat interface without a fixed width font. :P
no my question is is both statement do same thing ??
No, they don't.
so whats the difference ?
Do you understand how pointers and truth values work?
yeah but still I am not getting it
12:08
Do you know that *a does?
if(*a)
what*
its a pointer which takes the address of a ,in array it points to a[0]
The second part is right but the first part is wrong. *a does not take the address (reference) of a, it dereferences it.
The address of a is &a.
oh sorryt yeah it represnts the value of &a
So anyways, it just tests if the value at the address stored in a is true.
So for instance, if you had...

int i, *j;

i = 3;
j = &i;

if(*j)
/* do something */;

if(i)
/* do something */;
Both of these conditionals (*j and i) are the same thing.
j is a pointer which contains the address of i.
you mean to say in {if (*a && *a != ' ') } it checks both whether the value is not null as well as not space but in {if (*a != ' ') } it just checks whether its not a space ???
12:13
Exactly.
&& is a binary "and" operator.
So both *a and *a != ' ' have to be true in order for the conditional to be true.
you mean to say if i just use {if (*a != ' ') } it would be incorrect ?
That depends on what you're trying to do. It wouldn't be the same thing, that's for sure.
In fact, I'm not sure if the *a && *a != ' ' can ever be right. That seems definitely wrong.
thanks a lot ,actually i got confused with the fallowing code ,imgur.com/6yjAe3j
Oh wait, actually my bad, got confused. Yeah the *a && *a != ' ' is probably fine.
you helped me a lot by explaining this
12:17
Morning.
@sekhr So do you know why the *a is there? It's to check for the terminating NUL byte at the end of the string a, so the function doesn't recursively loop forever.
@Owatch Hello!
got it brother now I got it completely :)
@Owatch goodmorning
@oopaewem you made everything exactly clear :)
@sekhr Sounds good.
@oopaewem are you a student or working ?? which college ?
@sekhr I am neither, I'm working on my own projects right now.
12:26
@oopaewem but still you explains good ,finally I got my confusion all clear specially when you cleared about infinite loop .thanks again :)
Does anyone have any experience with modulo bias? I'm working on writing a protable RNG with C using only rand(), and for some reason there seems to be no bias even without correcting for it.
12:49
@oopaewem Share a code sample
I used this to generate over 128 billion random numbers both with and without (the paste is without) modulo correction with an N of 123456, and there was no meaningful bias for the first RAND_MAX % N integers.
The code is somewhat more complex than is necessary because it supports any arbitrary RAND_MAX using simple multiplication (not bit shifting), but on most systems that for() loop will only loop once.
@oopaewem How this sample would tell whether there is or isn't a bias?
Also, both with and without modulo correction the first RAND_MAX % N integers actually occurred slightly less than their mathematical average, and less compared to the unbiased integers.
The code doesn't include any mechanism to print the a[] array, but you would just have to write it to stdout, or to a file, or attach to the process via gdb and use that to examine it.
How do you examine it?
Regardless, it counts how often each integer from 0 to N is retrieved from rand() in the array.
Do you want me to just give you a complete version that you can compile and run with a printf() or something?
13:05
I want to know how you come to a conclusion whether there is or isn't a bias, a code sample to demonstrate it would be preferred, yes
Well, you understand the method though, right? I just store an array containing counts for every possible integer, and then see which ones occurred more often.
I've implemented quite a few PRNG related 'things', based on the standard rand()
@DrorK. Here you go: dpaste.com/27TCWD1
It takes my computer a really long time to run though, at least with 32ull*ULONG_MAX iterations.
It just prints the amount of times each integer occurred, separated by newlines.
13:40
@oopaewem Out of curiosity, how long have you waited for it to complete execution and print the results?
helloc all;
@DrorK. well, there are only two valid options there, I can think of: 1) you can use the CPP (and advanced techniques, such as x-macros), or 2) you can implement some hygienic macro system, which is working at the AST level
well, the latter is a pretty hard thing to do, not to mention, that if you want to share your code, first you have either convert it, or share your preprocessor along with your code (ofc it can be a full blown separate package)
Morning @PeterVaro
anyway, the latter would be the best, though it adds another dependency to your project
so, I'm voting on using the widely available and adopted standard CPP -- with all its limitations
Nah, I don't like it
is there anyone who does?
I've started implementing my own hygienic macro system using pycparser -- but I guess I didn't want it badly enough and I gave up on it
13:56
I think I'll use my INI parser with a PHP-like heredoc
So I'll have something like
pattern="print %d"
tokens=1,2,3,4,55
And this block will be created accordingly
and how will you inject the values? some kind of text replacement?
Yes, simply iterate the tokens list as text, so maybe even just %s tokens
(the problem never was about storing the values in a well structured way)
@DrorK. I mind you, if you want something not as hacky as it first sounds like, you also have to be aware of comments, strings, etc.
My INI supports comments
not that
the code where you want to inject your values
the INI part (storing values) is a piece of cake
14:01
Then I'm not sure what you're referring to
(though I would suggest you to use JSON for that -- at least it is standardized)
@DrorK. give me a full example of wwhat you want to do -- maybe I misunderstood your goal
I have lots and lots of repetitions of blocks/functions
oh, and the most minimal JSON parser I could think of in C is: jsmn (it is based on a brilliant idea btw)
add_d_ju()
add_d_jd()
add_u_ju()
add_d_jd()
14:03
And all such combinations
I simply want to create a template, and inject all the variables so it will be generated automatically
yepp -- that was the real question I've asked:
how would you inject the variables into the template?
where do you write your template?
As I've shown above ^ ... a simple printf() format, and a dedicated tokens/delimited sets of variables
pattern="%s"
let me rephrase it:
tokens="Hello", " ", "World"
Would print: Hello World
will you have a something like: vars.ini
[source.c]
var1 = 12
and source.c:
14:06
No, I'll have it within the source, just like a <?php ?> like block
int main(void) { int var = $var1; }
@DrorK. oh, okay, I see -- I was there too: github.com/petervaro/pypp
@PeterVaro Any special reason for choosing /* and //?
nope -- you could use the both with pypp
although I still think my approach wasn't bad, I did not finish the project, because at the end I realised I don't need it that much, as I can do anything with CPP -- even if that means, it would be hacky
I hate it, and now I have my casus belli to take it on
casus belli?
14:12
My reason to go to war
I see -- well if you want to start a war, you need very good weapons!
and building those is definitely not an easy thing to do!
Why, all I need is to parse: <? ?>, process this block via my INI, and apply a simple logic of its fields that reiterate printf's
well if you need only that, I see no reason, why you wouldn't want to use CPP
^ look at this for example
Because then I spend half my time aligning the '\'
And every time it shifts 1 character I lose my train of thought
then you should have a better text editor :)
for example sublime has multiple cursor selection!
14:18
No! The floor is not crooked
well, then why don't you write a small snippet instead which will print out the written multiline macros for you by aligning and appending `\` at the end?
Because that would mean to submit to the gods of cpp
and all you have to do after that is to copy/paste them to you document -- or even printf >> source
@DrorK. I see..
then I guess, I can't save you :)
Save your prayers for cpp, I'm going to war :)
Now I wonder if I'll ever wish to use <? ?> in-line
And whether I'll wish to use it puts("<? hello"); for some reason or another
Nah, I'll give up in-line
14:45
Hello.
15:08
@DrorK. have you met with this "error" (it certainly is not, as 1) valgrind says no errors occured 2) the builds agains glibc with gcc will allocate space for itself which will be donated back to the system, by the kernel if the program is not running anymore)
==30758== HEAP SUMMARY:
==30758==     in use at exit: 72,704 bytes in 1 blocks
==30758==   total heap usage: 1 allocs, 0 frees, 72,704 bytes allocated
==30758==
==30758== 72,704 bytes in 1 blocks are still reachable in loss record 1 of 1
==30758==    at 0x4C28CC6: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==30758==    by 0x67D517F: pool (eh_alloc.cc:117)
==30758==    by 0x67D517F: __static_initialization_and_destruction_0 (eh_alloc.cc:244)
==30758==    by 0x67D517F: _GLOBAL__sub_I_eh_alloc.cc (eh_alloc.cc:307)
it is just so annyoing.. I hate glibc and gcc..
(the source is as simple as int main(void) { return EXIT_SUCCESS; }
@PeterVaro Is it version-specific?
I have no idea, but I have a hunch that it is
glibc even have a __lib_freeres just to support proper memchecking..
(and that should be used here by valgrind..)
15:50
@PeterVaro ehhh... it's even worse with c++... getting rid of those false positives
 
1 hour later…
16:57
@Kamiccolo the audience are so ticklish, i mean they "LAUGH"
btw i saw some of this stuff in ppcg
 
1 hour later…
18:04
Helloc all;
*NULL
user4651282
helloc @Kotshi;
How's it going?
user4651282
not good, but I don't pay attention. Are you?
paying attention to what?
user4651282
18:16
not paying attention
user4651282
to what "not good".
Denial is an ancient cure
2
user4651282
in small doses like other сure
I'm good
Got drunk with friends last night
A friend got her cat stuck on a first floor balcony (first floor in a british way, not the ground)
And apparently I managed to climb and get it back while drunk -.-
18:45
So when do you get out of hospital?
Are you contesting my drunk-climbing skill ?
I bet you can't climb to a ten story balcony while drunk.
I bet that I would never try this
you’re from France, aren’t you?
Yup
18:49
I bet you can't climb a twenty story balcony.
@idmean I guess you've seen it on my profile?
@Owatch Thanks for wanting me dead
I really appreciate that
What about 167?
no, I’m trying to recognise nationalities by orthography etc.
I bet you can't get a cat there.
@Kotshi
18:51
Congrat
What mistake outed me?
the space before the question mark
France is the easiest ;)
We don't usually put space there...
That was a typo^^
Even when writing french stuff I don't put space before '?'
really? then a lot french make that typo
"Two-part punctuation marks
In French, a space is required both before and after all two- (or more) part punctuation marks and symbols, including : ; « » ! ? % $ #" http://french.about.com/library/writing/bl-punctuation.htm
of course not a very reliable source
You're right, I was googling it too^^
You're lucky cause I don't often put space here I guess
Well I don't really put a lot of attention in that kind of thing
You both have the same hat.
I wish I had that hat, and not this silly free one.
18:56
I noticed
It covers my ghost eyes.
People either get the white one or the blue one
I guess it's random
143
Q: Flip flop hat, what did I do?

Michael DibbetsI just got this flip flop hat. Whilst I find it extremly cool because it reminds me of the 5th doctor's hat, i'm confused to what I did to earn it.

The dress is clearly white and gold.
no, obviously black and blue
19:00
Actually, it was blue.
I saw it white and gold too
It can look blue.
The picture quality and lightning was to blame
But the gold does not look black.
actually I should have the blue hat and you @Owatch should have mine
Probably.
19:01
then it would match what we see
@idmean How about me )
you doesn’t seem to wear a hat
You don't have a known association for: ) ...?
oh, didn't see that
somebody here willing to take part in a little survey?
maybe.
19:08
would you be interested in this project emojicode.org ?
user4651282
too radically for me
@Atomic_alarm of course it’s an esoteric language
Why esoteric? Seems as practical as C to me :p
well, it’s actually built and working, I was just wondering if I really should publish it
I'm not sure what do you mean by 'publish it'?
19:15
It's real weird.
the source code, builds etc.; at the moment it’s just a domain and a GitHub repository
@DrorK.
@Owatch I personally can read it as easily as any other language...
Just looks like a bunch of fruits to me, formatted like code.
Looks fun
But I still prefer lolcode :D
I think I’ll really make it available and let’s see...
What do you fear?
Most of the emojis on your frontpages doesn't appear on my browser
19:20
@idmean If you care for a little typo: "have access too" should be "to"
@DrorK. Thanks, I’ll correct that
@Kotshi I've worked on this for nearly 2 years and now I’ll release my "baby" to the public
Well some people will like it
Some peoples won't care
I don't see what makes you hesitate^^
just setting up my local git repository
@idmean I'm not sure how representative this room is, better luck with channels on freenode, my suggestion: approach them when there are no on going discussions
@DrorK. Of course, but I intentionally wanted to ask somewhere with less traffic
19:26
@idmean Why your limits are (2^WIDTH) -1?
what’s wrong about that?
@idmean For example, why an object of 2^8 wouldn't have 256 representations?
256 representation, but the value 255 is the 256th representation as 0 is the 1st, or am I mistaken?
Correct, (2^8) -1 would be the last representation, but then you'd have "no more than 256"
If the range for 2^8 is a non-negative range + 0 , then there are 256 representations, 255 is the last representation, and there are 256 values
Given CHAR_BIT == 8 ... unsigned char's UCHAR_MAX is 255, but: unsigned char c; may represent 256 different values
But the documentation talks about integers and intervals, doesn’t it? And the biggest integer in the interval [-(2^8)+1, (2^8)-1] is 255.
19:36
I'm looking specifically at the Limits section
"No more than X things"
ohh, you are reading the specification, aren't you?
sorry, yeah, seems to be a mistake
In C for example, such things are 'intentional', to allow freedom when it comes to representations/encodings
So 'signed char' for example, is only required to have 255 representations
(it's also a possibility that you need to accommodate the case of 'no selection', then '0' for example, wouldn't be in the included range, so you'll really end up with -1 entities)
@DrorK. So you actually recommend me to leave it like that?
19:47
It depends on how you deal with it ^ ... how do you represent 'no selection'?
The limits you were reading about are for methods, variables and so on, and there’s no 'no selection', at least not yet
So if '0' is indeed within the range, then you shouldn't have the -1 ... but if you plan on having such a 'no selection' representation in the future, then I suppose it wouldn't hurt to keep it as-is
there are some plans for reflection so a special state might be need, I’ll leave it for now
How about signed integers- two's complement?
BTW, shouldn't it be: "an automatic storage", and not "a automatic storage"?
it should, thanks
19:56
(maybe it will be a good idea to run all the texts in a language processor (English), to see if it catches such things)
@DrorK. definitely, I'm sure there are many more typos in it
So do you have any requirements for signed integers?
for which integers? for those used in the byte code?
Any of them?
speed and cross-platform consistence
20:04
I'm not sure if I follow- they must be two's complement?
Overflowing a signed integer- is defined?
no, undefined
A byte is defined as 8 bits, or not necessarily?
necessarily
(I see that uint8_t is 'conditional')
you can now also view the source code at github.com/emojicode/emojicode if you are interested in
20:07
Thanks
(the compiler is a bit messy, I know)
20:22
@idmean You write implementation-specific C?
I try to do, is there something implementation specific
The project targets POSIX
-std=gnu11
Well, I'm not sure if I'm the right person to comment on implementation-specific things
hehe
ok, that’s because the compiler uses off_t and Linux compilers hide off_t without -std=gnu11
I suppose that if you'll decide or attempt to change that- the first thing you'll do is to let the compiler to show some hints with its diagnostics
20:26
@DrorK. It’s just replacing all off_t functions with the long versions. I’m working on that
Just watched someone detail their 30,000 USD computer on YT.
@DrorK. All packages compile with -std=c11. It’s definitely a goal for the compiler and engine too.
@idmean But I think I've seen there pointer arithmetic done on pointers to void?
(I didn't pay much attention, but I think there's a chance it breaks one or more of the effective types rules, too. [strict aliasing])
@DrorK. Goodness, I've completely forgotten that’s an GCC extension
And one more thing, I see that you don't care to check malloc/realloc for what they return- if that's the case, why don't you at least create a wrapper that exit() in case of an error?
20:31
@DrorK. That’s only the compiler... and that‘s not the only thing that’s wrong about malloc calls there...
But of course, that should be changed and is on my list.
So let me add two more things: you use exact-width integers (which are commonly available, but are optional), and you use non-basic charset characters within string literals)
At least I assume they weren't, I suppose it's possible they were HTML entities, but I think not
In any case, once you'll decide to put this effort ^ ... the diagnostics of gcc/clang/sanitizers will give you plenty of hints
I’m aware of the state of exact-width integers
Non-basic character set: I don’t think the standard forbids to place non-characters sequences in string literals, does it?
Oh, it's not about what it prohibits- but what's required
other way round then, does it?
Things which are not within the base-charset are implementation-defined
Again, chances are you won't stumble issues, but one more hint in case you're looking for something to do
20:41
UTF8 is fully ASCII compatible
so it should be no problem using UTF8 in string literals AFAIK
Well yes, but C doesn't require ASCII :)
please, don’t destroy my dream ;)
so it won’t compile using TurboC, who cares
@DrorK. you seem to be pretty familiar with the standards: can I safely replace my void pointer arithmetic with char pointer arithmetic?
Well, I'm having a delicious chocolate cake with double-vanilla frosting/coating
@idmean Yes. Personally I prefer 'unsigned char' explicitly, but pointer arithmetic on char * is fine
The problem is actually once you access the object as 'char', where it's not required to be the same as 'unsigned char', but once again that's unlikely to be a real-life concern
What is a real life concern, is breaking assumptions related to the effective types-rules (strict aliasing), which often being broken by such pointer arithmetic
20:49
What exactly do you mean in the last sentence?
It's a bit lengthy to explain, generally it means something like this:
char buffer[4]; /* given sizeof (int) == 4 */ int *p = (int *) buffer; *p = 123; printf("%d", p);
You understand why this is wrong?
If you're not sure, it will benefit you to spend a little time reading about "effective type(s)" or what's more commonly referred to as "strict aliasing"
Breaking such rules could result with severe performance/optimizations penalties, or the 'casual' undefined behavior
I don’t see how this is wrong as long as this is only used on the same 32-bit system.
You're referring to my example above?
What optimisation could a compiler perform here that would break this?
Yes
C has a notion of effective types, you're not allowed to access an object with a declared type, with an 'incompatible' effective type
So in this example, buffer is --> &buffer[0], which has a declared type of 'char'
20:55
I see. But that does not apply to dynamically allocated memory, does it?
Accessing it as being 'int' could break the alignment requirement for 'int', and even if it doesn't- it's still undefined behavior because the effective type is incompatible
With dynamic allocated memory the rules are a bit messy
But generally, it means that once you store a value, or copy a value/object with an effective type
The allocated object/region is now granted this effective type
Trying to access it for reading it/printing it, with an incompatible type, is UB
So I suppose it will benefit you to read a couple of articles and see that you follow the logic/rules/hints/guidelines given
Intresseting. Do you know how often this actually is an issue?
I think that it's an issue for anybody who uses -O3 and claims that "I stumbled a gcc bug"
I use -Ofast...
You said you saw this in the source code, can you give me a hint where?
It's likely to present itself as an issue when pointer-arithmetic is done on objects as being 'char *' ... to actually tell whether it is or isn't UB will require quite a bit of reading
So it would benefit you to read a couple of articles and understand whether this or that practice is applicable to your use case or not
(that's not to say that accessing the objects as 'char' is the problem, but generally from my experience people take liberties, such as 'type punning' or making alignment assumptions which are not necessarily true, and such practices should be avoided)
21:04
I am cautious in that perspective but I’ll anyway check to make sure.
I really appreciate your help!
Thanks a lot so far!
Sure thing, remember that you don't have to follow each and every one of my hints, some of them are impractical, so it's your decision what/how/when to address, hence why I try to 'label' things, but it's not always applicable
Of course, but a few of things you pointed out went on my list.
21:54
@DrorK. Got a particular article in mind? // Helloc btw
@Kotshi Morning, to be honest I'd hate to recommend this or that article, because I don't recall liking any specific article in particular
Okay^^
Your state of mind is still at morning?
Well sure, my up time is roughly ~35 hours or so
If that's not constitutes morning- what is?
Dunno
This may sound really strange without understanding the lyrics^^
Disturbingly strange :)
22:02
what the heck?
And ugly
22:46
hey
happy new year
Happy new year
Glob, rsync is eating my CPU
@Lamar I didn't know about the taco hat

« first day (589 days earlier)      last day (3267 days later) »