« first day (121 days earlier)      last day (4828 days later) » 
00:00 - 22:0022:00 - 00:00

12:00 AM
@JamesMcNellis ohh thanks
 
12:17 AM
well, color me surprised (but hopeful): Python barely edges out C# in popularity
 
I was never enthusiastic about that TIOBE index.
> The rise of C# and Python are continuing in 2011. Both languages scored another old-time high this month and are now busy with overtaking PHP.
Languages don't "overtake" one another. They coexist.
> The TIOBE Programming Community index is an indicator of the popularity of programming languages. The index is updated once a month. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. The popular search engines Google, Bing, Yahoo!, Wikipedia, YouTube and Baidu are used to calculate the ratings. Observe that the TIOBE index is not about the best programming language or the language in which most lines of code have been written.
So essentially, the index is completely useless. Nobody cares about the "language of the month" if you build systems that last for years or even decades.
 
it's problematic to measure language "popularity" either in terms of accuracy and precision or in terms of usefulness, of course
but the popularity of one language can certainly overtake that of another
 
And what does that tell us about the quality of the language? Nothing. Who benefits from such an index? Employers or employees, I guess?
> The index authors think that it may be valuable when accepting various strategic decisions.
[[File:Tiobe index.png|thumb|[http://www.tiobe.com TIOBE index] in 2009]] TIOBE programming community index is an ordered list of programming languages, sorted by the frequency of web search using the name of the language as the keyword. The index covers searches in Google, Google Blogs, MSN, Yahoo!, Wikipedia and YouTube. The index is updated once a month. The current information is free but the long term statistics over many years of observation is for sale. The index authors think that it may be valuable when accepting various strategic decisions. TIOBE focuses on Turing complete langua...
What exactly does "accepting various strategic decisions" mean?
 
Students, when deciding what languages they should learn.
 
Well, at least that would explain why many Java programmers suck.
^ Interesting read
 
12:28 AM
@FredOverflow as I said, it's problematic. it still speaks of the decisions that have been made by those queried for the index and can thus be useful in gauging trends even while taking the extreme (but not completely wrong) position of refusing to use it to make new project-specific decisions
 
Okay, so management looks at TIOBE and says "We must do the next project in Java because that's the most popular language"?
 
whose management is doing that?
 
Who does project-specific decisions if not management?
 
who said anyone should make project-specific decisions based on TIOBE?
 
Oh wait, you said "refuse". Damn I need sleep :)
But still, what does the following quote mean?
> The index authors think that it may be valuable when accepting various strategic decisions.
 
12:35 AM
your link was especially good, I didn't realize their "research" was that simplistic
@FredOverflow exactly, I wanted you to direct the complaints to them, not me, because I agree with you :)
there is at least some value in popularity for large projects: you have to find someone to write the code, and if you only hire, say, the top 1%, you want a large enough pool to choose from
 
@FredNurk Did you read Joel Spolsky? :)
 
sometimes, he doesn't regularly blog nearly as much anymore though, does he?
 
Oh, I just noticed that I have to accept or reject edits to my answers from other users. Is that a new feature?
@FredNurk Seems like it :( But I have 2 of his books :)
 
@FredOverflow relatively, there was a post on the SO blog about it
 
@FredNurk Link?
 
12:48 AM
blog.stackoverflow.com ? :P I remember reading it a while back
 
Aha, now I finally know what that funny number means :)
 
 
5 hours later…
5:44 AM
is this library "simple", when it consists of exactly ONE header file, of 40 753 lines?
 
5:59 AM
Dave Abrahams has posted an interesting opinion on the implicit move compromise: cpp-next.com/archive/2011/02/w00t-w00t-nix-nix
(I don't know if that's been posted in here yet; I haven't been around much the past few days.)
 
@JamesMcNellis I don't put much credence on Dave's opinions about that anymore. That's because he and Doug Gregor co-authored the paper pointing out basic problem, and basic solution. And then Dave went off switching his opinion 180 degrees, showing that he didn't understand his own paper,.
 
@AlfPSteinbach I read "Implicit Move Must Go;" I'm not sure where he "switched his opinion 180 degrees."
Granted, I've spent so much time learning C# recently that I haven't really paid attention to the implicit move fiasco.
 
6:26 AM
@JamesMcNellis I wonder if we should add some c++ blogs to the room feeds; read that in particular earlier today, and that would be a good feed here, I think
 
6:49 AM
@FredNurk Maybe. There are a few C++ blogs that I'd think would be good to add: for example, C++ Next, Anthony Williams's blog, and Herb Sutter's blog.
 
I read all three
I don't think it really fits in with here, though. they're much less traffic than questions (for example) and will be lost if put in the ticker; also likely to be lost in chat if posted as messages by "Feeds"
maybe the best is to just point people to stackoverflow.com/questions/151974/…
 
I think it might be worth considering adding a few top blogs to the C++ tag wiki page. (I don't really follow any blogs; I am just lucky that people tend to point me to blog posts when they get posted... I've just never found an easy-to-use and update RSS reader.)
 
7:05 AM
@JamesMcNellis i was informed about the one you posted from "new comments" e-mails. TB does have built-in RSS reader. Opera has a primitive one.
 
@JamesMcNellis the "question" I linked is in the c++ tag wiki; I find google reader easy enough to use, but I suppose I'm not too picky in that area
 
for mainstream news i use the RSS feeds in Firefox
 
@FredNurk Now that you mention it, I follow a lot of things on Google Reader. I just never go to the Google Reader web page. I need an RSS reader that pops up articles on my screen and refuses to relinquish focus until I've read the articles. Maybe that's asking too much :-P
 
I have Sage RSS reader extension in Firefox but I don't use it, I just use the built-in functionality
 
At the moment, I am kind of hoping this Twitter thing turns out as a good way to get notifications of blog posts and such.
 
7:08 AM
@JamesMcNellis Ah, you're a Bird Man. Me, I'm definitely not. I think Twitter is 100% mindless junk. I get really Really REALLY annoyed by Twitter feeds in the newspapers.
 
@AlfPSteinbach We are in agreement then: I too think that Twitter is 100% mindless junk.
 
@JamesMcNellis I use a chrome extension that has a counter; unfortunately I have several high volume feeds, so the counter has been at "1000+" for weeks. I do group into folders in reader, and that's the biggest help to find what I want
 
7:49 AM
google's style guide rears its ugly head again
 
what? You want the constructor to fully initialize the object?
I think the google style guide is re-assuringly pragmatic
 
a constructor that constructs the object? how novel! :P
2
 
but sometimes does not go far enough curbing the more silly ideas the language zealots adhere to
 
it is pragmatic: for working with google's extensive existing codebase
I am not working with google's existing code in my projects, but I don't know about you
 
itspragmatic. for writing code that works as expected
and isn't a fucking ballache to use
1. constructors with parameters have been a pain until c++0x
 
7:55 AM
I expect a constructor which doesn't throw to have constructed the object; so does the language: that is the only case in which the dtor is called, and in that case the dtor must be called
 
I expect the constructor to do the minimum amount possible.
 
you can change the entire meaning of your class by expanding it to include zombie states, but those are a fucking headache
 
and to take zero parameters.
 
you should be writing C
 
You shouldnt be writing at all.
but enough with the insults
non trivial constructors have a huge number of problems
they break virtual overrides.
which are sometimes quite necessary to perform a proper initialization of an object.
and they break various environment restrictions:
All c++ implementations on windows intiialzie statically allocated objects (and destroy them) in DllMain
which is a time when any "threadsafe" code will cause loader lock deadlocks.
I personally think that that is easilly avoided by disallowing the use of global static classes
But thats hard to audit.
So the big language issue for me is, virtual functions don't work in constructors.
(well, don't even try and pretend that they way they work is at all useful).
so, unless you eschew the use of virtual
you cannot safely ever perform a non trivial initialization in a constructor
and again. no compiler implementer has seen fit to provide so much as a compiler warning if it detects a call to a virtual in either the constructor and destructor
So, go ahead. Write non trivial constructors.
Its like building your house on a flood plain.
A good solid house, made of bricks, and built to all the relevant best practices specifications.
 
8:21 AM
@ChrisBecke constructors break virtual overrides in Java and C#, not in C++
@ChrisBecke "virtual functions don't work in contstructors" -- that's incorrect, nonsense, balderdash
@ChrisBecke "so, unless you eschew the use of virtual you cannot safely ever perform a non trivial initialization in a constructor" -- jeez, man, you've been taught a whole load of bullshit. if i were you i'd want to load a shotgun with real course-grained salt and take on my teachers. happily much of this is covered in the C++ FAQ (Marshall Cline's FAQ)
2
 
Xeo
wow, first time in the chat.. and the first thing i think, is that "Lounge<C++>" looks like a template...
 
he he ... :-)
 
@AlfPSteinbach is he still going on about that? this chat lacks many features, but I'm glad for ignore
 
@FredNurk don't know but it's Chris Becke. and i have agreed mostly with much of what he's said earlier, even if a bit controversial. good stuff. makes one think. but this latest. somebody has taught him bs.
@Xeo yes. there was some discussion about whether it was proper syntax. I think it can be in C++0x... ;-)
 
Xeo
it would actually be a template of <C>, wouldn't it?
 
8:33 AM
i think @Johannes demonstrated that current title could be valid C++0x syntax...
 
Xeo
@AlfPSteinbach care to explain why? I always heard virtual functions don't work like one might think they do in the constructor of a base class, but is there anything else to it?
 
@Xeo in Java and C#, if you call a virtual method from base constructor it invokes implementation in yet-to-be-initialized derived class. that's pretty dangerous, and is one of the most common bug sources in Java. in C++, when a constructor of class T executes the object is of dynamic type T (not of derived type). virtual functions work just as you would be expect. but the object of is of type T, so virtual functions work as they would for object of type T. that's more safe.
 
struct Foo( virtual void m()=0; Foo(){m();}};
struct Bar : Foo{ void m(){}};
 
@AlfPSteinbach I've agreed with him before too, but here he's gone off the deep end
 
As an incredibly trivial example
 
8:37 AM
@Xeo there is a special FAQ entry about how to handle derived-class-specific initialization when you use the more type-safe C++ scheme (as opposed to in Java). That's sort of 50% "my" FAQ item. I convinced Marshall to include it. It's in the "What your mother never told you" section
 
Instantiating Bar() will cause a pure virtual call.
 
@ChrisBecke Simpler example of UB: int main(){ main(); }
 
Xeo
@AlfPSteinbach "so virtual functions work as they would for object of type T" I see, I always thought it was undefined behaviour.. so it behaves as the function was non-virtual? What's with pure virtual functions?
 
yes its UB. But unlike main() its UB that can hide in plain sight.
 
@Xeo not the same as non-virtual; think of it as the dynamic type of the object is updated as base class ctors are executed
 
8:40 AM
@Xeo no it doesn't work as if the function was non-virtual. if you call a virtual function declared in some base class and overridden, the override is executed. calling a function that is pure virtual in T, from a T constructor, is UB. A good implementation will catch that and produce some run-time error.
 
a bad implementation will not, and produce a run-time error
 
Xeo
@AlfPSteinbach I see, thanks
Ah, I think I didn't phrase that well enough... with "behaving like non-virtual functions" I only meant in the base class, that they're calling the overridden versions of derived in the derived constructor was somewhat clear.. or am I still wrong somewhere?
 
you're still wrong in a niche case
 
you can think of it this way: in constructor of class T, any classes derived from T do not exist, as far as effect of execution is concerned. apart from that it's all business as usual. no special rules, it's just that the object is of dynamic type T
 
consider three classes, A, B, and C, where B derives from A and C derives from B. calling a non-virtual method of A in B's ctor, which then calls a virtual method in A, will call the most-derived overrider from the POV of B
@Xeo codepad.org/wrsnRWAy; if B::v was not declared and A::v was not defined (you can define pure virtual methods), this code would be UB
 
8:52 AM
@AlfPSteinbach of course, if the T code handles objects of classes derived from T, then that simplified rule is not good enough. but, roughly. :-)
 
and yet, you continue to defend the position that non trivial construction is safe?
 
Xeo
@AlfPSteinbach I can't think of any situation, where having a base class handle it's derived classes would be a good decision (from what I know)
 
@Xeo inheritance is overused and the example I give is extremely rare, as is that
 
@Xeo it's common in GUI. like, with proper design a constructor for a class Widget has to create an API-level something, say, an API-level button widget, or an API-level listbox widget, depending on the derived class that's invoking the constructor. that's because after construction of Widget, that base class part should be fully functional, not needing any more patch-up. there are many ways to handle it properly, described in the FAQ.
 
@Xeo but compare it to asking "why does everything go wonky when I close(1)? (close stdout)" – a seemingly sensible question, but braindead code is the problem in the first place
 
Xeo
8:59 AM
@FredNurk I kinda like inheritance for my games. Not too deep, but two to three derives deep. that being said, I am currently studying game programming, and that since 1 1/2 years only, so I might not have the grasp on how to deal with such situations otherwise
 
what? When did inheritance become considered harmful?
 
@Xeo that's fine, you should use it where it helps. I'm talking about examples where people try to fit disparate problems into that model, such as separate Square and Rectangle classes (to take a common abuse in examples)
 
Xeo
little off-topic: can I store boost:function s in an std::map using a pointer to boost::function_base as the value type?
 
@Xeo haven't checked but i don't think that's safe. boost::function is designed as being copyable. just use it directly.
 
9:14 AM
@Xeo why would you prefer to store function_base over function?
 
Xeo
@ChrisBecke storing many functions with different signatures, and I can't think of another way to accomplish that. but thinking again, even that wouldn't work...
 
@Xeo you need some sort of union or variant type, and that implies manual runtime checks on every use
a common alternative is enforcing a specific signature that's generic enough to work for anything, then having each callee check for what it needs
just depends on your requirements, as always
 
I'm thinking, would you want to have a relationship with someone who singes "Do wah diddy" all the time?
 
@AlfPSteinbach how hot is she, and can I smile and nod while wearing headphones?
 
Xeo
9:25 AM
@FredNurk well, i'm writing a little console class to enable function calling from ingame. i think the easiest way would be to enforce a signature of void (istream&) ... but that'd be too bad, as i'd have liked to register any function to the console, maybe even member functions with a bound instance
 
@Xeo boost handles binding objects to ptmf
taking an istream sounds like an especially poor choice
following what unix has done for decades isn't a bad idea; notice your use is even similar – even the same terminology with "console"
 
Xeo
@FredNurk well, except that i never used unix, so what does unix do? and why would an istream ref be a poor choice?
 
and that would be a vector of strings; if you want to do "options" or "named parameters", then you can initially preparse those into another list of (name, value) pairs (but not a map if you want to allow duplicates, and not a multimap if you want order to matter)
@Xeo because iostreams suck, and little bits of parsing from an istream spread out all over sucks even harder
 
@FredNurk :-)
 
Xeo
offtopic: how to disable that damn feed?
 
9:31 AM
@Xeo the exact signature of what I described would be a function taking vector<string> args and vector<pair<string, string>> kwargs ("keyword args") or the moral equivalent
 
@Xeo regulars can do it, but I'm not sure about how the consensus is formed
 
@Xeo you can't, it's a global room setting; I think I saw a bug report / feature request from @sbi about it, but it was declined
 
Xeo
@FredNurk Eww, k.
@FredNurk Sounds reasonable, thank you
 
@Xeo you still have to have each callee understand and parse its arguments out of that, but both separating out named parameters (as a very common need for almost all commands) and defining common utilities for multiple callees will each help considerably
 
Xeo
gotta love typedefs. boost::function<std::string (std::vector<std::string>)>...
 
9:49 AM
@Xeo Consider boost::function<std::string (std::vector<std::string> const&)>
 
boost::function<my::Callable>
I suppose you're typedefing the boost::function, so you don't need to invert it as I have
 
Xeo
@FredNurk Yeah, but how would you typedef that Callable ? like a normal function pointer? -- forget that, works ^^"
 
no, like a function :)
typedef string Callable(vector<string> const&);
 
Xeo
@FredNurk learning something new every day! thanks :)
>error C2206: 'foo' : typedef cannot be used for function definition -- n'aww damn it. time for good ol' macros
 
10:04 AM
you couldn't supply names for parameters when using a typedef to define a function like that
 
@Xeo like Fred I did not remember that detail. but you can use just old C syntax, like typedef string (*Callable)(vector<string> const&). no need to use macros
 
though it would be interesting for zero-arg functions
@AlfPSteinbach it's not my typedef that's causing him problems, it's doing "Callable func_name { /*func_body*/ }"
 
Xeo
@FredNurk yeah, I'm just a bit lazy with writing, so I typedef long stuff and always use that :')
 
@FredNurk re "him", i think Xeo is female :-)
 
Xeo
@AlfPSteinbach Why would you think that?
 
10:08 AM
I'm usually careful about that :( but I default to male pronouns out of habit
 
@Xeo avatar + gut feeling.
 
@AlfPSteinbach I'd have gone with avatar too, had it been big enough to see in chat – and I'd not been too tired to check :)
 
Xeo
@AlfPSteinbach As wrong as it can get. The avatar is just one of my favorite characters in a game called Touhou
 
@FredNurk you need larger screen
 
sbi
@JamesMcNellis I thought so, too, until I had played with my subscriptions for a while. Now that I'm down to a few not too talkative ones that are interesting (or personal) to me, I actually start to like the thing. I have little to add, though, for me it's more about getting informed than it is about informing other.
 
 
2 hours later…
12:37 PM
anybody got a reply to my comment?
0
Q: Bit-level endianness

cpxHow to check the 'endianness' of OS at bit-level or Does an OS even care in what order the bits are stored?

 
er, tricky one.
good point tho.
I do suspect the question is badly phrased.
 
probably
 
char x = 128;
if( x & 1 ) throw "Weird big bitendian struct".
I mean, thats clearly ridiculous
the order of bits in a char isn't a question that makes sense. each bit has a value, but no particular left to right order.
 
@Tony what is your comment supposed to point out?
 
the only time the bit packing order could ever make a difference would be in parsing data from across the wire...
but I think, even there, the bit order is defined in the ethernet spec
 
12:49 PM
@FredNurk can't you access less then 8 bits at a time through a packed struct?
 
no
if you mean bit-fields, then you can, but bit-fields aren't addressable and are just irrelevant here
 
yes I meant bit-field
removed my comment
 
"packed struct" means to me, as I think it does for most, a type without padding bytes anywhere and often used for direct IO (usually as premature optimization)
 
@FredNurk oh sorry, was using the wrong wording
see I was thinking about a packed data type, where you put different data in the same bit string, mostly done to save space, so that's why I called it 'packed struct', as you're packing different data in the same bit string
but that's obviously the wrong word for it, it seems
 
"packed" is generally used (even in compiler #pragmas) to control alignment of data members (which thus affects padding bytes)
 
12:55 PM
ah I see, well I learnt something :)
 
 
1 hour later…
2:03 PM
what the hell did I say at 12:40 that was so objectionable that someone deleted it?
 
sbi
2:30 PM
@ChrisBecke I wouldn't know, but it takes several people to agree that something is objectionable in order for the server to delete it.
 
 
1 hour later…
3:45 PM
hi
 
@DeadMG hi
 
anything interesting happen?
 
I have to make a decision on concurrency... if you call that interesting
maybe you can advice me?
 
go for it
 
so I have a TCP/IP class to send/receive data on a socket, currently i'm receiving all i want on that socket and passing it to a worker thread through producer/consumer pattern (queue), now the sending part is the problem. I currently have it also on a queue and sent on the same thread as the receiver, however the client blocks and waits for a response, so I can't afford the unreliability of some other thread sending then the one handling the request.
 
3:59 PM
the ideal thing to do would be to use multiple worker threads
and post work into the queue for any thread to work on
 
however do I really wish to go share my TCP/IP object amongst multiple threads and thereby be unable to receive/send at the same time, as they both use the same object?
I do have multiple worker threads (thread pool)
 
ok
I'm not completely sure that I understand the problem
you perform asynchronous reading, and then post work to a worker thread to do work
then..... what?#
 
currently I post the reply back to a queue for the TCP thread to send
however that means I can't rely on it to do that immediately as the worker has posted it on the queue
and this is what I need
as my client is blocking on the request
 
yeah
but the client won't be sending whilst it's blocking
so you know that the TCP thread is free
 
yea, but what about the multiple client situation, which i'm gonna have
 
4:04 PM
then use a thread pool to dispatch asynchronous send operations
or rather
 
that's not going to be too much threads in a single program?
 
server programs can have thousands of threads
but if the OS provides asynchronous I/O functions, then it likely won't be many
 
i'm using boost::asio async.send
 
ok
so the send function is asynchronous
 
so I guess that a send is really not much work at all
so these threads won't be doing much
 
4:05 PM
even if you have multiple clients, the bottleneck won't originate there
having a single queue for send requests is no big deal
hell, you could dispatch it straight from the worker thread, since you know the send is async
 
that's what I've been considering
however should I use the same object as I use for the receive or should I create a different one?
if I use the same I have to lock it
cause it ain't threadsafe
so then send/receive will have to wait on one another
 
that's not true
you need one separate socket for each client, and you know that you won't be receiving whilst sending
there's no reason that you can't have a TCP object that can be thread safe per socket
 
socket is not thread safe
if using the same object...., but maybe I have done something wrong for the multiple client situation
 
Distinct objects: Safe
you should not be using the same socket for multiple clients, you need to use multiple sockets- I believe
 
I think you might be right, per definition of a socket
src port, src ip, dst ip, dst port from what I remember
 
4:11 PM
I'm not a networking guru, so don't take my word on this as gospel
but as far as I know, each individual connection needs an individual socket
 
ok, researching it right now
 
don't you have a network guy at your company to ask?
 
none that I trust
ok, it does create a new socket, however boost asio abstracts that away from you
 
4:47 PM
@Tony - thats the definition of a connection
BSD sockets, which boost:Asio and CSocket and everything else wrap. are kernel mode objects
and hence implicitly thread safe.
you can, and many people do, call recv and send, from different threads, at the same time, quite safely.
one of the issues with native sockets is canceling a blocking read... the only way to do it in fact is to use a second thread to close the socket if the connection has been interrupted.
 
@ChrisBecke what's the definition of a connection?
 
a tcp connection is defined by the endpoints. ip:port-ip:port
 
5:19 PM
This can't be correct
what should boostrap do? and ./bjam on windows??
 
@Nils presumably bootstrap is a batch file that attempts to find some C compiler, and builds [bjam.exe]
 
humm
 
REM Try and guess the toolset to bootstrap the build with...
REM Sets BOOST_JAM_TOOLSET to the first found toolset.
REM May also set BOOST_JAM_TOOLSET_ROOT to the
REM location of the found toolset.

call :Clear_Error
call :Test_Empty %ProgramFiles%
if not errorlevel 1 set ProgramFiles=C:\Program Files

call :Clear_Error
if NOT "_%VS100COMNTOOLS%_" == "__" (
    set "BOOST_JAM_TOOLSET=vc10"
    set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\"
    goto :eof)
call :Clear_Error
if EXIST "%ProgramFiles%\Microsoft Visual Studio 10.0\VC\VCVARSALL.BAT" (
 
let me download the newest boost source
The system cannot find the path specified.
Access is denied.
wtf
 
Xeo
5:38 PM
general question: is it really considered that harmful to use preprocessor macros?
 
no
 
yes
shouldn't be done unless you have something that absolutely cannot be accomplished another way
 
I read a paper some weeks ago about MonetDB using macros to avoid function call overhead..
there are some cases in which it makes sense
 
@Xeo The shorter the macro name, the more delicious the macro, but also more dangerous
 
Xeo
@DeadMG Does conversion from function names to strings count?
 
5:46 PM
is the Japanese word for pufferfish and the dish prepared from it, normally species of genus Takifugu, Lagocephalus, or Sphoeroides, or porcupinefish of the genus Diodon. Fugu can be lethally poisonous due to its tetrodotoxin, therefore has to be carefully prepared to remove toxic parts and to avoid contaminating the meat. The restaurant preparation of fugu is strictly controlled by the law in Japan and several other countries, and only chefs who have qualified through rigorous training are allowed to deal with the fish. However, the domestic preparation occasionally leads to accidenta...
 
you can't do that by template or some other method, so a macro's pretty normal for that
 
Xeo
@AlfPSteinbach Oh, it's not about typing lazyness this time :)
 
@xeo - i consider it that harmful. because I do cross platform dev. and almost any sane name is already used by something.
 
does window's built-in unzip thing have a problem with zips of large files?
 
not as far as I know
but how large?
 
5:47 PM
well the boost distro
but it seems slow
 
Xeo
@ChrisBecke Okay, that might be a problem because macros have no namespace.. but considering the game is my semester project, I don't think I'll go for cross platform
 
6:16 PM
so building boost worked now, I guess it didn't extract correctly the first time or something
 
 
1 hour later…
7:22 PM
@Xeo There is nothing wrong with using a macro if it is an appropriate tool for the job. For example, with a few ugly macros you can accomplish a lot of awesome code generation tasks.
 
Xeo
@JamesMcNellis Best example would be BOOST_PREPROCESSOR, eh? :)
 
I use the Boost.Preprocessor library extensively.
 
@AlfPSteinbach C++ is like the Fugu of programming languages. Potentially deadly when handled by the unskilled :)
3
 
Xeo
7:42 PM
@FredOverflow That comes with the fact that it's actually 3 languages.. wie got the powerful preprocessor, the templates with their own meta-programming and c++ itself. and i have to admit, i love it
 
The preprocessor is actually pretty lame. It could be much more useful and much easier to use. The algorithm used for macro replacement is so convoluted, the specification doesn't exactly match any of the (commonly used) implementations. We make do with what we have, though.
 
Xeo
@JamesMcNellis Now you got me thinking, would one be able to implement a nice preprocessor with just batch on windows?
 
8:12 PM
0
Q: LNK1112 on Windows when trying to link my project against gtest.

NilsHi all I get the following error when trying to link my project against gtest: fatal error LNK1112: machine type "x86" conflicts with target machine type "X86" I'm using cmake for both my project and gtest to build. What I ask myself where is the "machine type" of a library set and how can I c...

 
8:39 PM
@Xeo a really nice preprocessor would probably need to be integrated with the language syntax in some way (even if it is not understood by the compiler), e.g. scoped macros; this is one way c++ templates and "hygienic macros" (in other languages) shine
 
hi all
can you help me to differentiate the following just read in book
in c++..compiler avoids creating storage for const....in c const always occupy storage..what they mean by..in c++ compiler avoid to create storage?
 
sounds like they're trying to explain a rather complex implementation detail too early and botching it badly
 
@user388338 They mean: "We, the authors of this book, barely know what we're talking about, so what we're saying can't be depended up and shouldn't be trusted."
 
C compilers can make the same optimization that C++ compilers can in this case
 
i read it from bruce eckel
 
8:48 PM
"thinking in c++"? for a free ebook, it's not bad, but it has problems
 
hmm..well i bought it ...so even in c++ "const always occupy storage"
 
no, const objects don't always occupy storage
 
@user388338 No, not really. C++ has rules about the circumstances under which a const-qualified variable must have an address, but they basically boil down to the fact that if you use the address, it'll have one. If you just use the value, it might or might not. C doesn't have exactly the same rules, but basically works out the same way.
 
consider void f() { int const n = 3; int a[n]; } // in c++, n is a compile-time constant and unless its address is taken or it is passed by reference, it doesn't need to "exist" anywhere. in c, that is actually a VLA, but the compiler can treat it exactly as it does in c++
 
thanks fred and jerry ...i want to know..does literals stored in register?
i mean in your above eg ..n ll exist somewhere like in code segment..data segment...or nowhere?
 
9:00 PM
it might not exist anywhere
depends on what you do with it
 
@user388338 in my exact example, n doesn't have to exist anywhere
 
Xeo
Could just be substituted with its actual value, depending on how you use it
 
@user388338 the compiler can, and is encouraged by users, to perform some complex transformations in order to optimize; this is fairly low on that scale in terms of complexity
 
indeed, it should perform complex optimizations
I sure as hell don't want to have to hand-optimize it
 
thanks dead ,fred,xeo for your reply..you made things clear
hey guys..have to go now..bye happy programming !
 
00:00 - 22:0022:00 - 00:00

« first day (121 days earlier)      last day (4828 days later) »