« first day (285 days earlier)      last day (4680 days later) » 

7:00 PM
Man, I'm in the wrong profession. Dentists are the highest paid profession in the US
 
@0A0D Above lawyers?
 
@EtiennedeMartel Yep
3 out of 4 are independent
$230K avg salary
 
@0A0D omg..
 
Gotta marry a dentist and then move to the US.
 
7:04 PM
> Tarn has been single since graduate school, when he dated a Cisco systems administrator for a short time. I asked him whether he wanted children. “I don’t mind the idea of never having kids,” he said. “I want to stay focused on the game, and if I had kids, I’d wind up paying attention to them instead.”
Man, that's passion.
Or obsession.
 
@MartinhoFernandes What is "The Game" ?
 
Dwarf Fortress.
 
@kbok It's the one you just lost.
 
@EtiennedeMartel Lol yeah
 
@MartinhoFernandes or both
 
7:07 PM
@EtiennedeMartel I stopped saying "I just lost The Game" because I always get bashed when I do
 
I just lost the game too
 
You all did
 
@kbok did you say that phrase often?
 
Oh not that.
 
7:08 PM
@jalf When I was in high school, all the time. We used to leave post-its on our friend's stuff
Writing in their notes
 
"Le jeu"
 
"O jogo"
"El juego"
im out of languages
 
:D
 
quiz: a template is given: template<typename T, int N> struct C;. Write a partial specialization such that all uses of C will use the partial specialization!
 
A good suggest everyone : take a look at "Advance Linux Programming"
 
7:15 PM
er, why?
 
@jalf because it is advanced, the title says so
 
no, it says advance
I don't want to advance linux programming
 
lol it is written advance
even when you said I read advanced :P
 
I think you should read "Basic Linux Programming" first.
 
why would you try to program linux with basic?
 
7:19 PM
Like any other language: you get a basic interpreter/compiler, and do it.
 
Fixed it.
 
:-" Advanced
 
@EmAdpres well, why? Why do I need to learn advanced linux programming?
 
beside of It's name , you can find some important concepts there .
you can learn many new things !
I like it !
 
but why do you assume that we have any interest in learning Linux programming?
I mean, do you often suggest arbitrary books to random people?
 
7:29 PM
@jalf : What do you do as a career ? you're a programmer or .. ?
 
yep, I am
but I know a lot of programmers who have no interest in linux programming
 
I write code in C#, using WPF, on Windows, in Visual Studio 2010. I don't have any interest in Linux programming.
 
And of those who are interested in linux programming, most of them already know it
 
what is the rule for declaring and using const arrays in C? Any gotchas?
 
yes
they are completely different from C++ ones
 
7:30 PM
It might be a great book for people interested in learning advanced linux programming, but most programmers aren't in that situation
 
const in general is
 
const in C# is very const. Much more so than C++ const ;)
 
const in C always generate storage and only means that it's value doesnt change in execution. You cannot use it like a #define MACRO the way you can use const in C++
 
so what about an array passed to a function and declared as const in the function definition?
 
is that legal?
 
7:34 PM
you can't change the contents of the array
err
it means the function wont change the contents of the array
 
const in C# basically means compile-time constant. Afaik, it's only allowed on class members?
 
so it is legal and harmless to pass a non const array to it
 
@jalf Who said anything about C#?
5 mins ago, by 0A0D
what is the rule for declaring and using const arrays in C? Any gotchas?
 
@jalf forget "Linux", I'm talking about concepts that every top programmer should know about them , such as "Dynamic Libraries" , "Multi Threading" , "Interrupts" and ....
 
(that is not true in some C compilers for microcontrollers like keil's C51 for example, and microchip's C18 and possibly others)
 
7:36 PM
@EmAdpres Not every programmer needs to know about interrupts.
And there are probably better books for multi-threading.
 
@EmAdpres You wouldnt happen to have a vested interest in selling these books?
2
 
@EmAdpres Interrupts are pretty damn specialized. Most programmers have little need for knowing about those. Dynamic libraries are both platform-specific and specific to C/C++. And there are a lot of good books on multithreading.
 
@EmAdpres Multithreading is best learnt in a book about multithreading.
 
@Collecter : It's free
 
C has no const arrays
 
7:38 PM
A book with "Linux programming" in the title, eh.
 
@JohannesSchaublitb explain
 
typedef int a[5]; const a b = { 0 }; means a non-const array whose elements are const
in C
in C++ the qualification is bidirectional, but there is a defect report about this, because the c++ standard is incomprehensible here
 
@JohannesSchaublitb maybe you can answer this one:
0
Q: C -- changing a multi-dimensional array to CONST in a function?

user3262424I have the following c function declaration: float Sum2d( const unsigned int nRows, const unsigned int mCols, float arr[nRows][mCols] ) { float sumAll = 0; // I would like to make this change illegal! arr[0][0] = 15; for (int i = 0; i < nRows; i++) for (int j = 0; j...

 
But since it's free, maybe there'll be something funny in it.
It starts with publishing errata to a PDF file.
 
You know what else is free?
 
7:42 PM
sigh
 
The Unix Haters Handbook
 
I know there is many good book for each of them , but the book I referred, talk about all of them as minor . that way I can understood , what's a thread exactly, and if I interested , I can learn it more in a separate book < sry for weak eng :D >
 
Not a good start, book.
Just upload a damn corrected PDF, you lazy bastards.
Geez.
I love that the table of contents is in another file.
 
@CatPlusPlus a single pdf exist for this book !
 
@EmAdpres The problem is, I know of a lot of good books, many of which I haven't read. When some random person tells me on a chat room that "this book is really good", why should I care? Why should that book get priority above all the other good books I haven't read?
 
7:45 PM
Because it's good?
 
so are cookies
 
@jalf Play any new board games recently that are good?
 
@jalf And that's why you should eat cookies.
 
@Collecter nope. Been pretty slow lately. Last time we played Dominion and Smallworld. Can't remember if I mentioned those
Descent-day on saturday though, yay!
 
@jalf yeah, I know . But my goal is , to introduce what I seems to be nice , to my other friends just as a suggest !
 
7:46 PM
Oh boy, first chapter is drooling all over Emacs.
 
@jalf Have not heard of a game called smallworld. I love Dominion though. Prosperity is so broken....
 
This is not going to end well.
 
are you introducing it to your friends though, or just to everyone you can find?
 
> If you press the Tab key on the line with the call to printf, Emacs will reformat your code to look like this: [code with one tab added]
AMAZING.
> The easiest way to turn on colorization is to edit the file ~/.emacs and insert the following string: (global-font-lock-mode t)
Lol.
 
@Collecter Smallworld is kind of Risk done right. Fewer dice rolls, fixed game length, a lovely art style, and some pretty neat game mechanics
 
7:49 PM
Global font lock mode.
Of course it turns on syntax highlighting.
How could it not.
 
each player picks a randomly-generated combination of race and special power, and play that race as long as you like. Then you can let it go into decline, leaving your race's tokens on the board to score more points for you, but while you take control of a new race
 
GNU/Linux is nice to use once you stop using emacs.
 
@jalf I will have to look into it.
 
fairly simple, and pretty family-friendly, compared to most
but good fun
 
@0A0D yeah in C++ that "const" would work
 
7:50 PM
There is as much non-GNU software in Linux as there is GNU one.
 
I brought it to play with my mom and sister a week or two ago, had a ton of fun
 
@jalf take it easy .. you can just skip , but maybe somebody , interest..
 
a bit more mainstream game though
 
@CatPlusPlus GNU in GNU/Linux only refers to coreutils
 
@EmAdpres I'm taking it very easy. I just don't find it very persuasive when a completely random stranger walks up to me and says "you should read this book"
 
7:51 PM
@kbok It's meh.
 
@kbok emacs is not a part of coreutils, is it?
 
@MartinhoFernandes emacs is not really the most popular software on linux
 
they made a dog glow in the dark, how cool is that
 
@jalf should ? no, no ! just I recommend ! you can skip or not
 
@kbok It isn't?
 
7:52 PM
@hexa cool?
 
@hexa I've seen it with a frog a few years ago.
Linky for the dog?
 
Oooh, subchapter on make. It tells you to run info make. So useful.
 
And I mean, a frog was born that glowed.
 
@MartinhoFernandes Is this a real question ?
 
Not that they painted a frog with glowing paint.
 
7:53 PM
@EmAdpres yes, but it's still a recommendation from someone I know nothing of. That carries about as much weight as a recommendation made by someone in a TV commercial
 
-1
Q: how to fix stack overflow error in visual C/C++?

user1122I am writing a file in C/C++ which generates 100000 lines of records (name, int[5] grade, double[5].value). The code should generate 100000 random characters for name and integer for value. I am getting stckoverflow error. Can anyone pls help?

 
i am trying to find a link in english
 
aRRRGHGG A GDH» OERJH IRHG JLA AHS Stop overflowing me with messageS!
 
When will they ever learn?
 
@MartinhoFernandes spam spam spam spam spam spam
 
7:54 PM
I'm confuzzled as to who's the target audience.
 
@MartinhoFernandes We never spam you.
 
@MartinhoFernandes I'm sorry.
 
I'm trying to keep three simultaneous conversations across two separate rooms.
Everyone is spamming me!
 
Eh?
The only active room is this one.
Stop talking with yourself.
 
Not right now.
 
7:55 PM
> Listing 2.2 shows an example of how you might use getopt_long to process your arguments. [three pages of code]
 
@MartinhoFernandes Is in the C# room also...
 
@jalf Let's introduce myself :)) A Top Student @ Computer Engineering , which love programming and love know about everything at least , as define and purpose of that thing ! B-)
 
@CatPlusPlus Oh dear.
 
/* The name of this program.  */
const char* program_name;
Oh my.
 
@EmAdpres Is that a cover letter?
 
7:56 PM
And yeah, it's global.
 
//increment by one
i++
 
The chapter is called "writing good GNU/Linux software"
 
@CatPlusPlus Scope is for chumps.
 
/* Main program entry point.  ARGC contains number of argument list
elements; ARGV is an array of pointers to them.  */
 
@CatPlusPlus what is wrong with that const name btw?
 
7:57 PM
In the introduction they said they assume you're familiar with C and/or C++.
 
@CatPlusPlus Well well. So, it's a crappy book then?
 
@hexa It's the comment that's funny.
@EtiennedeMartel I don't know, I'm only starting.
 
@EtiennedeMartel I dont know "cover letter" :D
 
@EmAdpres "Top student" seems pretentious.
 
Top student is pretentious.
 
7:59 PM
And going into shell again. I'm really confused who is supposed to be reading this.
 
@CatPlusPlus Top students?
 
@MartinhoFernandes I don't see the problem if you're actually in the top list
 
Ugh, assigning string literal to char*.
 
@CatPlusPlus My guess is no one.
@CatPlusPlus I think that works in C.
 
@EtiennedeMartel forget it !
 
8:01 PM
@CatPlusPlus const is for chumps.
 
@MartinhoFernandes Nope.
You write to it, boom. Especially true when string pooling is used.
 
But if you don't write to it?
 
@MartinhoFernandes It's basically asking for trouble.
 
Then it should be const, just to be on the safe side.
 
And we don't need no more trouble
 
8:02 PM
But it works.
 
GCC warns with "deprecated conversion of string literal to char*" or something like that.
 
@MartinhoFernandes It's ugly.
 
> 2.2.1 Using assert
No, really, who the fuck is the target audience.
 
lol
 
You said on at least one occasion one should be already familiar with C, and now you're explaining bloody assert.
 
8:04 PM
Maybe it's targeted at DOS C programmers.
 
@0A0D i downvoted both wrong answers
 
@kbok assert is not Linux-specific.
 
@JohannesSchaublitb ? Oh the newline question?
 
i gave a comment on the more elaborate answer
 
> For performance-critical code, runtime checks such as uses of assert can impose a significant performance penalty. In these cases, you can compile your code with the NDEBUG macro defined, by using the -DNDEBUG flag on your compiler command line. With NDEBUG set, appearances of the assert macro will be preprocessed away. It’ s a good idea to do this only when necessary for performance reasons, though, and only with performance-critical source files.
 
8:04 PM
@0A0D on teh array question
 
Oh lord.
 
@JohannesSchaublitb oh, let me go see
@JohannesSchaublitb I still don't know why I got -2 on this answer : stackoverflow.com/questions/6864759/…
 
> Because it is possible to preprocess assert macros away, be careful that any expres-sion you use with assert has no side effects. Specifically, you shouldn’ t call functions inside assert expressions, assign variables, or use modifying operators such as ++.
So poorly worded.
 
@MartinhoFernandes But it's more recent than C, isn't it ?
 
BAD : assert ( doIt() == 0 ) ;
Good: int tmp=DoIt(); assert(tmp==0 )
In this case you can use NDEBUG safety !
 
8:06 PM
@kbok It's standard.
 
@MartinhoFernandes Ok.
 
@EmAdpres It's poorly worded, because you can safely do assert(some_function_that_doesnt_affect_the_program_flow_because_oh_well_its_fo‌​r_debugging_purposes(foo, bar, baz))
Not that standard assert is any good, with it breaking to debugger inside C library.
 
BAD: go crazy with side-effects
Good: don't go crazy with side-effects
 
if you want to exam "some_function_that_affect_the_program_flow" you need do that way
 
real man debug solely with printfs
5
 
8:08 PM
@MartinhoFernandes FTFY.
 
> Another thing to bear in mind is that you should not use assert to test for invalid user input. [...] Use assert for internal run-time checks only. Some good places to use assert are these: [...] Check conditions on function parameter values.
Oh fuck me.
 
It's OK to use accessor functions in assertions. If the only failure mode is illegal memory access, then the assertion might crash when -DNDEBUG is disabled, but that's a good thing.
 
int computer_is_on() { return 1; }
assert(computer_is_on());
// run code safely
am i doing it rite?
 
@hexa Well, if you're a motherboard then it might return 0.
 
@hexa I've seen code in the wild that used JavaScript to test if JavaScript was enabled in the browser.
 
8:10 PM
AND THEN WHAT.
 
I've seen it in the TDWTF too, for obvious reasons.
 
LOL, that would be bad in a power management microcontroller.
 
@CatPlusPlus alerted something like "You need JavaScript enabled".
 
@MartinhoFernandes I was continuing my thought.
> Often, when a system call fails, it’ s appropriate to cancel the current operation but not to terminate the program because it may be possible to recover from the error.
Okay, so far so good.
And then it goes to this little snippet.
Ah, stupid PDF.
 
ok, so anyway, @EmAdpres, thanks for the recommendation but as you can hear, most of us tend to be skeptical of unsolicited recommendations from people we've never met before. :)
 
8:15 PM
But oh well, I think you'd be able to see the problem.
Again, someone said something about being familiar with C.
> Linux cleans up allocated memory, open files, and most other resources when a pro-gram terminates, so it’ s not necessary to deallocate buffers and close files before calling exit.
Right.
It's chapter 2 of 10.
 
Releasing resources is for chumps.
 
That's true, but so fucking misleading.
 
@CatPlusPlus What does "most" mean ?
 
it's good style to close and free buffers
 
@kbok Doesn't say.
 
8:18 PM
Hmm, database locks, for example.
 
@kbok In particular, does "most" include flushing stdio and iostream buffers?
 
@Potatoswatter I'm pretty sure it does not
 
@jalf I'm glad to hear that :)
 
It's a great book! At least I'm having fun.
 
@CatPlusPlus :D
 
8:20 PM
> One major advantage of a shared library is that it saves space on the system where the program is installed. If you are installing 10 programs, and they all make use of the same shared library, then you save a lot of space by using a shared library. If you used a static archive instead, the archive is included in all 10 programs. So, using shared libraries saves disk space. It also reduces download times if your program is being downloaded from the Web.
I'm sorry, are you from the past?
 
Bahahahaha.
 
shared libs are good for system perfomance tbh
not for those reasons he said
 
The book is 2000-ish, I think we had HDDs large enough to not worry about that.
 
haahahaha
 
And tonight is my birthday ! Hoora ! :D
 
8:22 PM
And something something about dlopen at the end.
 
@CatPlusPlus But broadband penetration was insufficient.
 
@Potatoswatter Yeah, I could understand downloads, though it doesn't really make that much of a difference.
Well, that book did not age well, let's state it this way.
> A RUNNING INSTANCE OF A PROGRAM IS CALLED A PROCESS
I'm sorry, you can be familiar with C and not know this?
 
I doubt there's anything about that in the C standard.
 
If you can read the standard then you definitely know what the process is. :P
 
wow, I guess they assume total noobs are gonna be reading that
 
8:27 PM
> Two common techniques are used for creating a new process. [system, fork/exec]
 
Well, it's "Advanced" so it makes sen... Oh wait.
 
No love for popen or spawn.
And who the hell uses system for real, anyway.
 
I heard popen is as evil as system.
I like fork + exec because it's basically "magic" and "more magic".
 
@MartinhoFernandes you've never studied their implementations?
 
For the longest time I couldn't understand how the hell exec works.
 
8:29 PM
i hear fork and exec is slow
 
I definitely prefer CreateProcess way rather than this arcane nixism.
 
@JohannesSchaublitb Says who?
 
@TonyTheTiger Why would I? From what they do, it seems like I would need some understanding of kernel to make sense of them.
 
there is a posix create process function that is faster
 
posix_spawn?
 
8:31 PM
@MartinhoFernandes "When a fork() system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by the OS for the child process."
 
yep posix_spawn
 
@TonyTheTiger I know that. I've used fork/exec extensively in my Operating Systems class (I implemented a shell).
 
@TonyTheTiger linux has had COW for ages...
 
AFAIK modern nixes don't copy all the pages, but rather use copy on write.
 
didn't we already discuss forking today?
 
8:32 PM
Yeah.
 
@MartinhoFernandes oh, well I didn't know that, I was merely trying to be helpful
and I've learned something too now :)
 
I don't know if I can make sense of their implementations.
 
Well, it's a common sense, really, copying all of the pages could take forever after parent has run for a while.
 
i wonder how big the posix standard is
 
> Note how the signal handler stores the child process’ s exit status in a global variable, from which the main program can access it.
 
8:34 PM
this big | |
 
fork abuse
In computing, the fork bomb is a form of denial-of-service attack against a computer system which makes use of the fork operation (or equivalent functionality) whereby a running process can create another running process. Fork bombs typically do not spread as worms or viruses; to incapacitate a system, they rely on the (generally valid) assumption that the number of programs and processes which may execute simultaneously on a computer has a limit. This type of self-replicating program is sometimes called a wabbit. A fork bomb works by creating a large number of processes very quickly in...
 
@CatPlusPlus Unfortunately, that's a necessary evil.
 
I really hope that global stuff will end by the time I get to multithreading.
 
yea I hope for you too
 
@TonyTheTiger I posted a detailed description of how Cygwin implements it here. Note that the Cygwin implementation is probably more complex because it doesn't fit the Windows API very well.
 
8:35 PM
why are you reading that book @CatPlusPlus?
 
@TonyTheTiger For shits and giggles.
And because someone said it was good and free.
 
It is free.
 
Thinking in C++ is decent and free
 
@MartinhoFernandes Thx man :)
@CatPlusPlus ohhh... I love shits and giggles :)
 
Meh, okay, enough. The thread stuff seem to be slightly better, although it seems like it's more of a pthreads reference.
 
8:49 PM
a vectorof raw ptrs to objects, i will have to delete manually right?
I mean the pointers
 
If the pointers are owning the objects, yes.
Probably better to make it a vector of shared_ptr or unique_ptr.
 
@MartinhoFernandes not for this exercise though
In production code yes
 
Or ptr_vector.
 
"What's the different between << and >> ? " , he asked ...
:))
 
9:00 PM
hmm, the order of STDOUT_FILENO and STDIN_FILENO are reversed from the order of the file descriptors returned by pipe(2).
 
They are?
They are not.
> filedes[0] is for reading, filedes[1] is for writing.
STDIN_FILENO (0) is for reading, STDOUT_FILENO (1) for writing.
 
ah, thanks. I'm glad I "asked"
lol
 
that R.. dude always has good C answers
 
@hexa I can't tell if he's programmed the scariest CPUs out there, or if he's a good language lawyer. Seems like both.
 
lol yeah
 
9:15 PM
> Initializes sb using mode, and passes &sb to the base class initializer. Does not allocate any buffer.

That's a lie. We initialize the base class with NULL, because the string class does its own memory management.
 
@MartinhoFernandes The base class is basic_iostream, and its member basic_streambuf pointer is not initialized to null.
 
For clarity, the "That's a lie" line is not mine. It's in the docs.
 
what header is rand() in?
 
<cstdlib>
std::rand()
 
Yiiiiep.
 
9:33 PM
now, a const pointer to an object, can you alter the object?
so const Animal * a can you alter what a points to
 
@TonyTheTiger No, because that's a pointer to a const object.
A const pointer to an object would be Animal * const a.
 
oh thx, that always confuses me
 
when in doubt, read it right to left.
 
@MartinhoFernandes oh i see, it's right in the source. <sstream> line 295. Interesting…
 
Animal * const is a const pointer to an animal. const Animal * is a pointer to an animal (which is const)
 
9:37 PM
Animal const * a would also be valid and it is a pointer to a const Animal.
 
what is const constexpr Animal *const
 
@JohannesSchaublitb Hmm?
 
@JohannesSchaublitb constexpr pointers ? is that even allowed ?
 
Dude hops in here, says BOOK is good, then leaves...
 
@kbok why not?
 
9:43 PM
Is he going to sell me WoW gold.
 
@JohannesSchaublitb §7.1.5/9: "A constexpr specifier used in an object declaration declares the object as const." — However I'm not sure if const is allowed to precede constexpr; constexpr const Animal *const is the properly confusing alias to constexpr const Animal *.
Hmm, now I'm not sure which is more confusing.
 
Wow, that really is a mess.
const constexpr Animal redundantly_specified, *not_redundantly_specified;
Am I right? lol
 
Hi @Xaade!! What's new?
 

« first day (285 days earlier)      last day (4680 days later) »