« first day (745 days earlier)      last day (4429 days later) » 

06:06
yeah I m on widows with traditional Turbo C compiler :/
ok not ask for Y/N but should show that msg atleast
Whatever thx guys for help
The message should be displayed. That wherever that message appears is dismissed instantly is not so much a property of the program as a property of the environment.
I dont know .... I am also using getch(); before return 0;
is there any effect of that ?
Ok i have done these MATRIX programs 1) Addition 2) Subtraction 3)transpose and 4) Multiplication
No. Different spot in the code.
anything left in Matrix
Can show you the code ?
No, it's yours.
06:11
ok here it is if you insists :P
Declare your variables close to where they are first used. Minimize scope.
what is EXIT_FAILURE defined as?
???
It's a posix macro iirc.
is that a C language thing? Don't you need #define EXIT_FAILURE 1 or somesuch?
06:13
what i only know is exit(..) thing is used to exit :P
Actually it seems to be part of the C++ standard: EXIT_SUCCESS, EXIT_FAILURE
well I'll be darned.
anyway what is the problem? You can't read the program output because it closes too fast?
EXIT_FAILURE is the only way to exit from a conformant, portable C (or C++) program that communicates failure.
@DextOr Okay, now that you know it, forget it. You should virtually never use exit in C++. It doesn't (usually) unwind the stack, so you normally want to throw something that isn't caught until it returns to main, then exit from there.
yeah @nixeagle
printf("\n Multiplication not possible\n");
exit(EXIT_FAILURE);
06:15
Jerry, he is using C i think
I don't see anything from the std libraries.
yea yea I m using C
Would you recommend throw 1; as a better alternative than exit(...)?
ok guys I think discussion must be closed over here ......
//O-P\\
@StackedCrooked No. Won't be caught by catch(std::exception const& e).
now I am heading towards C programs to manage files operations
06:17
@LucDanton That would be the intention, to throw a fatal exception.
It's okay to write an exception (derived from std::exception) which purposes it is to be caught in main. This allows local objects in main to be destroyed, unlike other methods.
With stack unwinding.
Also @luc I don't usually exit using exit(), my programs either work or crash out. Then again I don't write full applications usually, just math/sci stuff.
@StackedCrooked I'm a user of Boost.Exception and I'd at least like to derive from boost::exception to add information to the active exception.
In any case if you ever change your mind you can add or remove bases to that exception class. Not so much with int...
Quick question: what is "a" in atoi()?
06:19
ascii
iirc
Thanks.
was actually coding a form of that for a specific class of very large numbers I was working with earlier.
well, doing the reverse operation, number to string for output.
Now it should be done with boost::lexical_cast.
huh?
Perhaps I should first ask: is it OK to allow fatal exceptions to escape from main() (and as a consequence terminate the application)? I don't see the point in catching them inside the main function. Also if you let an exception escape from main and you have a debugger hooked up then it will break at where the exception was thrown.
mark, my 'huh' is meant to mean 'why'.
@StackedCrooked It's not okay.
@nixeagle It is better than the alternatives.
What is the problem?
@StackedCrooked It's not okay esp. for released apps.
06:24
mark, well I just write a function to do it and move on. What advantages does that give over the simple and obvious way.
Ah, I just read that stack unwinding is not guaranteed if the exception is uncaught.
I didn't know that.
@nixeagle Simple. It's proven. It's safe. You do less of the work.
Stacked, I do it when I'm developing stuff, then again I don't write full applications in the software engineering sense.
Mark, but I have to define my conversion anyway. I'm not just converting int -> std::string here.
@StackedCrooked You end up in std::terminate. Which perhaps you're okay with, but then why not just call std::terminate/std::abort or some other flavours of such at the throw site? That way you don't destroy your call stack...
@luc read what Stacked wrote. If you don't catch it, the stack does not necessarily unwind.
06:29
@nixeagle If you don't throw anything. you're sure everything is intact. Why play with fire?
I get the feeling that C++ is getting in the way of Microsoft's .NET domination in Windows.
Because you are quickly developing something and intend to actually catch it at a later time?
@nixeagle You can write your own die_in_flames function. You can change at any point whether that function throws or e.g. call std::abort. It's a way better alternative than hardcoding throw sites.
That's how you develop quickly. Write black boxes for which behaviour can be substituted.
throw T(); means 'give up locally and let someone higher up deal with it'. "I don't know what to do" is only half the story!
lol, I usually do it while I'm programming bottom up. The thing is nothing I write is ever distributed to a wider user base. If something throws and is not handled it usually means the whole computation is foobar and I have to read the logs anyway.
I do see your point though, but generally I try to actually handle things by the time I'm finished.
sbi
sbi
@R.MartinhoFernandes And I still haven't gotten a call? Where're you staying?
06:36
@MarkGarcia Embrace, extend, ...
@StackedCrooked That's what Steve Ballmer always do.
sbi
sbi
@EtiennedeMartel Well, he's a cat, so what do you expect?
@Cheersandhth.-Alf This was in response to a message that was talking about child-parent relationship, and in that sense, you're a child, too. Of course, that message dealt with financially dependent children, but when you study you might depend on your parents until long into your 20s. Also, it was about the child "making a living", which necessarily seems to include older children.
is it necessary to give function prototype before using it ? :/
no, but it is a good idea.
@DextOr No.
06:46
But program is working fine withour it :P
right, prototypes are useful for when you want to reuse that function in another module
can you explain me what it does ie...function prototypes
@DextOr Also, prototypes enable you to call a function defined below the call.
sbi
sbi
@DextOr No, it's not. The reason is that every definition is also a declaration. (You might want to carefully read that answer.)
ok :|
06:47
It would be impossible to implement mutually recursive functions without forward declarations.
sbi
sbi
@DextOr It declares the function. Again, read that answer on declarations and definitions. You seem to need it.
C++ needs Y-combinators.
fine @nixeagle that could be genuine reason
sbi
sbi
Fuck, this keyboard is shit.
@sbi How long did you type that message?
06:49
DextOr, put another way, when you say int foo(int b) { return -b;}, you are declaring the function int foo(int b) implicitly.
@sbi :D
sbi
sbi
@MarkGarcia Long enough to make me go to the shelf, get down my Logitech Illuminated Keyboard, and plug that into this shitty laptop my new employer handed me.
a prototype is a fancy word for declaration.
@sbi Laptop keyboards always suck.
Can't do anything productive.
sbi
sbi
I had a damn good Dell at my previous job, and that one had a nice keyboard.
06:51
C++ can be quite complicated, I just ignore the parts of it that are not useful to me.
ya am using Dell key.b its good :)
sbi
sbi
@StackedCrooked It still going strong after a quarter of a decade, so far nothing hints at that, though. I mean, really.
What, except for C and C++, is alive and kicking from that era?
lisp?
FORTRAN
sbi
sbi
@nixeagle The problem with this is that often you won't know that something not only is useful, it also is necessary.
@nixeagle Alive? Yeah. Kicking? Nay.
wish I was better at FORTRAN, would have been useful this last few months.
FORTRAN is definitely kicking in the science and math fields.
sbi
sbi
06:54
@nixeagle Learn template meta-programming. Expression templates make for numerical code that's as fast as FORTRAN's.
sbi, and how long does it take to understand the template soup you write a month after you wrote it? I swear C++ templates sometimes look strangely like perl. :( I get they are useful, but...
Granted the new auto keyword helps
sbi
sbi
@nixeagle That depends on your expertise in reading them. :) Also, understanding the code is nothing compared to understanding the hilarious amount of garbage the compiler throws at you should you make an error. :( That, too, depends on your expertise in reading them, though.
while(*temp)
{
..
sbi
sbi
BTW, I think we should go through the book question and very visibly update which books are already published or Planned To Be Published Soonâ„¢ with C++11 in mind.
9
There's already a new edition of C++ Primer, and there's also a minor note on its entry in the book question, but this is not visible enough. Should we make a big division between books that are already updated, books that aren't, and books that don't need to be? Or just a prominent note saying Not updated for C++11 to embarrass the author? :)
how *temp will be tru or false
06:59
@sbi sounds good to me.
sbi
sbi
@Stacked, can you pin that message, please?
char *temp;
@sbi Done.
sbi
sbi
@nixeagle Since you are referring to me as a person, rather than to any of my messages, I have no idea what you are referring to and just assume that "sbi" sounds good to me, Ok?
@StackedCrooked Thanks!
@sbi right :/ If I had the time to invest, I'm afraid working with fortran is more appealing than C++ template meta programming for the reasons you listed. Right now when I get desperate I just break out assembler.
blah, yea I agreed with what you wrote and wanted to say so before I finished thinking out my response. Sorry
and related bugs
07:02
thx @sbi
@sbi It's the result of the dereferencing that is used as a condition, not the pointer itself.
sbi
sbi
@LucDanton Um. Blush.
The only thing I can say in my defense is that it's 8am here, and I am sitting at the computer with my pajama and a bowl of corn flakes in my hands.
Does that count?
Too many green default gravatars.
@sbi to be honest, I understood what you meant to write. :)
sbi
sbi
@Rapptz Yeah, there's more than one. OTOH, with all those real photos in thumbnail size I cannot tell one from the other either.
@nixeagle Then you understood more than I did. (What I wrote was right, but didn't apply to the code in question.)
07:06
@sbi you were close, just messed up wording.
sbi
sbi
@nixeagle No, I didn't. I messed up facts.
Well maybe I passed over that. What you wrote made sense to me as you were essentially saying that when the memory location pointed to by temp is 0, the loop terminates. His question was how did it know if *temp was true or false. Basic while loop stuff that looks for say, a terminating 0.
sbi
sbi
@nixeagle I was answering the case of temp, not *temp. Except I concluded from that it's dereferenced that it is a pointer, so I had seen that it was dereferenced.
07:41
Preprocessor directives that indent the # is allowed, correct?
I won't run into any trouble on certain compilers?
eg
foo;
        #define bar foo
7 hours ago, by sehe
I added another answer... catering for the OPs changed question. I must be mad :)
^ oh well, unsurprisingly, it is pearls before swines all over again:
Thanks much for the response. As to the linq to object answer you posted above, I do have random order of the < R>< O> and < FP>< R>< O> so the < R>< O>s dont necessarily follow the < FP> tags. So the solution here may not work. For the linq to xml, I am implementing this in Win 8 metro style app and looks like there is no System.xml.xpath. that kills it. — user1186390 2 hours ago
@Pubby You won't run into trouble. The usual style is # define bar foo though, IME
@sehe Okay
I hate the CPP :)
Join the choir :)
Hi, this is a little of topic... but,, are there anyone using trac?
and know if there is anyway to add a CamelCase word to some kind of ignorelist?
I know about the ! "operator" and the ignore_unknown flag.. but would rather lika an ignore list
Anyone else agree this is a dupe: stackoverflow.com/q/13134608/85371
sbi
sbi
07:54
@Pubby Actually, I think it isn't. At least, I remember it wasn't in the 90s, when only C had a standard. As @sehe said, the # goes into the first column, the rest can be indented. I have never met a compiler that didn't accept indented #, too, but officially it wasn't allowed.
@Pubby, actually this: /cc @sbi
20
A: Indenting #defines

anonPre-ANSI C preprocessor did not allow for space between the start of a line and the "#" character; the leading "#" had to always be placed in the first column. Pre-ANSI C compilers are non-existent these days. Use which ever style (space before "#" or space between "#" and the identifier) you pr...

sbi
sbi
@sehe Oh, by Neil. I'll take this as authoritative, then, and retract my statement, @Pubby.
Also: rich info and various IDE tips & tricks via this search: stackoverflow.com/search?q=%5Bpreprocessor%5D+indent
I take it C++ uses the same PP standard as C?
@sbi SO is an amazing thing. I found that dupe just a few messages above by searching too, only after I went reading specs and toying with static_assert....
@Pubby Yes. That is, C99 will use the same PP as C++11 - or so I have read somewhere
08:10
Slow chat t'day. I'll head to the office
Does the C99 standard mention C++ anywhere? Or vice versa? Are they aware of each other's existence?
@StackedCrooked The C++ standard references the C standard
The C++ Standard lists a C Standard as a reference (C++11 refers to C99 as C11 was published some months later). Doubt it's the case the other way around.
@StackedCrooked Vice versa on a number of occasions
If you say it like that it's like they are flirting.
08:17
@StackedCrooked well, maybe they are, in a way
that might not be a bad way to look at it
I agree.
meowing
Perhaps we should add thumbnails to the book question as well.
08:43
moe moe kyun
0_-
@Mysticial Did someone put a sock in your mouth?
am I kawaii? uguu~
Ell
Ell
what is a choke? talking about motherboards?
08:53
@R.MartinhoFernandes Hallo!
isn't a choke in a car?
@sbi Oh, I was expected to call you? I missed that part. :S
lol
Robot's robotic social skills? :P
@sbi Right now, I'm staying near Kollwitzplatz, but I'm going to be seeing some apartments elsewhere.
Ell
Ell
I thought a choke was a car too
09:03
@StackedCrooked No, but I was eating. :)
@Pubby No!
image not found
09:32
Hi
@Pubby Dear lord.
@Zoidberg'-- I like your comments on the Singleton question.
c program to list files in directory
please tell me how this program wrkng
where is the struct ffblk a;
09:50
@DextOr presumably it's defined in one of the included headers?
@DextOr Have you googled ffblk?
:D
how to created that image :P
09:54
lolz thx for meme thing :P
If you want her number, just ask for it. — hillsons 4 hours ago
This made my day :)
Wow, your day must be boring.
lol
so you got a few flats to go view Robot?
It is, indeed
I'm trying to create a drop-down list with a sucky old C API and it just does nothing. I hate that.
Have you checked error codes? :)
Ell
Ell
for windoze?
@TonyTheLion Well, by a few, I mean two. Most of the time, either the owners don't reply, or they reply saying they are not available anymore.
@FredOverflow There's no error codes for this API
10:03
Why do you have to use C?
@FredOverflow Why do you assume that? You can use C APIs in C++.
Actually, you can use C APIs in almost any language.
Because the GUI I'm fixing bugs in has originally been written in C with that stupid crap API.
I still don't know why Dietmar named that lock kerberos. It's driving me nuts. (It's been edited out now, but that doesn't change the driving me nuts part)
well, kerberos was supposed to be some kind of guardian dog controlling access to something, iirc
which is what a lock does too :)
@R.MartinhoFernandes oh right.
10:08
@jalf Oh. So simple.
except locks don't usually bite
or have three heads
that'd be my guess, anyway
it's why the "other" Kerberos is named Kerberos, at least
The one you're constantly complaining about?
yup
the very same
I feel silly for thinking "Knights of the Zodiac" before "Greek mythology"
I feel silly.
2
Ell
Ell
10:14
can a python use a ruby API?
can any language use any other without going via c?
I don't see why not, but I swear c gets treated specially by the OS
@Ell some can
Yes, by going via some other common communication protocol.
all .NET languages can interoperate fairly smoothly, for example :)
@Ell You can always rely on serialization-based protocols
10:16
@Ell it has nothing to do with the OS. It's just that C defines a stable and simple ABI with so little functionality that every language can map to it
Ell
Ell
I know .dlls are kept in memory, can a DLL contain arbitrary data?
it's easy to wrap C code
@Ell Sure
How is this evaluated? a = b != c
@Ell You can put whatever you want in DLLs. For instance there's icons in shell32.dll
10:17
@StackedCrooked Correctly.
:P
@StackedCrooked Right to left.
Ell
Ell
I am just confused really because it seems .a and .so and .DLL and .obj are all to do with c aren't they? or are they not?
@Ell No, it's just native code.
10:18
Not any of them, really.
@Ell they're executable file formats, and nothing else, really. The executables are defined so that they can contain executable code as well as arbitrary resources
which language the code was compiled from doesn't matter
.NET uses dll files too :)
as does C++ ;)
@R.MartinhoFernandes I just noticed something like this in our codebase if ((a = b != c)) { ... }.
Double brackets look suspicious.
They are there to silence GCC warnings, likely.
@wilx That's the "standard" way to tell the compiler "I know what I'm doing here, and I really want assignment; don't warn me".
At least for GCC.
double brackets usually indicate that the weird thing contained in it is actually intentionnal
10:27
without the extra parenthesis, it'd warn you that you probably meant == instead of =
@R.MartinhoFernandes same in Clang. Not 100% sure, but I think MSVC gets it too
@wilx cppcheck reports it as: style: Suspicious condition (assignment+comparison), it can be clarified with parentheses
WTF. Plugging in my USB mouse lowers the volume.
static MISHORT ___CRV_OPT_NEW = FALSE;
in a way, it comes for free, because if you add the parentheses, then it will no longer parse as an assignment inside a condition, but rather a condition with some nested expression, and an expression which involves an assignment. Compiler writers don't really have to do anything to "opt in" to this convention
Longest underscore trail contest ^
10:29
@kbok I win____________
@jalf Nope, you don't______________________________.
Seriously, why do people do that ? Do they feel like 1337 H4X0R because they use more underscores ?
to avoid name clashes probably
Because obviously _CRV_OPT_NEW and __CRV_OPT_NEW are already taken
(Note that using legal identifiers is ofc out of the question)
Habit/Consistency?
10:34
I'm afraid it's for consistency
Because they saw the private __XYZ compiler-implemented macros, they must have thought it looked nice and did the same.
It gets better
(void) IASSIGNMENT_ROUTER_MANAGER->GetManager();
Found another suspicious one: if (a == b | c && d != 0) { ... }
@StackedCrooked that one is nasty
Yeah. Also c is a compile time constant equal to zero.
10:40
lol
@StackedCrooked if (a == ((b | c) && (d != 0))) { ... }
@R.MartinhoFernandes std::string(std::numeric_limits<std::string::size_t>::max(), '_'); I WON
std::bad_alloc says you lost.
std::numeric_limits<T::size_t>::max() isn't the max size for T
Xeo
Xeo
10:48
std::string(std::string().max_size(), '_'); should be fine...
@Rapptz | has lower precedence than == according to this table. So I think it's (a == b) | ((c && d) != 0) (I'm probably getting it wrong as well ... )
@StackedCrooked I used this table. Which actually states the same thing.
My mistake.
Phew, I almost panicked.
is it safe to delete an object while inside a virtual function? No new calls are made to any member, just finishing the existing one
Though yours is still wrong, I think. != has a higher precedence than &&.
10:51
Yeah
So it's probably (a == b) | (c && (d != 0))
Yeah, that makes sense. Pretty ugly.
Xeo
Xeo
And since you said c is a compile-time 0, you have a == b.
@StackedCrooked bitwise OR for bools?
Xeo
Xeo
@melak47 It's the same as ||, just without short-circuit behaviour.
MSDN's table is pretty ugly. I like cppreference's better.
10:54
Is comparing to 0 still faster than comparing to non-0 nowadays?
Xeo
Xeo
Was there ever a difference?
A long time ago I think
I compare everything to your mum.
@Pubby it depends
@jalf Care to explain?
10:57
@Pubby it may generate more compact instructions
so, if less code == faster, uhm, it may be faster
I once read that !strcmp(...) could be faster than comparing to zero because it provides a hint to the compiler that we are only interesting in equality and not greater/less than. Or something like that...
The x86 CPU has an instruction for checking of a register contains zero. It doesn't have a general-purpose "is X == Y" instruction
iirc
Hm, ok
hmm, or maybe it does :)
cmp?

« first day (745 days earlier)      last day (4429 days later) »