Moderators: phlip, Moderators General, Prelates
Dason wrote:Are there any major advantages of 3 over 2 that might persuade somebody to use 3 instead?
Vaniver wrote:Harvard is a hedge fund that runs the most prestigious dating agency in the world, and incidentally employs famous scientists to do research.
afuzzyduck wrote:ITS MEANT TO BE FLUTTERSHY BUT I JUST SEE AAERIELE! CURSE YOU FORA!
Aaeriele wrote:...dictionary comprehensions.
roband wrote:Mav is a cow.
RoadieRich wrote:Aaeriele wrote:...dictionary comprehensions.
2.7 has them.
But then you can't do nonsense like this!EvanED wrote:Some of the stuff I like are the newfound inability to set True and False
typeof(string).GetField("Empty").SetValue(null, " ");troyp wrote:RoadieRich wrote:Aaeriele wrote:...dictionary comprehensions.
2.7 has them.
Hey, cool! I didn't know that.
2.7 has set literals, as well, btw.
Vaniver wrote:Harvard is a hedge fund that runs the most prestigious dating agency in the world, and incidentally employs famous scientists to do research.
afuzzyduck wrote:ITS MEANT TO BE FLUTTERSHY BUT I JUST SEE AAERIELE! CURSE YOU FORA!
EvanED wrote:be aware that when most people say "regular expression" they really mean "something that is almost, but not quite, entirely unlike a regular expression"
roband wrote:Mav is a cow.
RoadieRich wrote:Is it just me, or are the streams on sockets in Java backwards?
Jplus wrote:It's been mentioned several times on these forums.
It does miss some of the bad things of C++, but I think in exchange it's also missing some of the good things. It also doesn't seem to add anything spectacular you couldn't have in C++ some way or another. So until somebody can point out such a thing to me, I'm not enthousiast.
(Off-topic: if that was bad English, anyone please send me a PM...)
EvanED wrote:be aware that when most people say "regular expression" they really mean "something that is almost, but not quite, entirely unlike a regular expression"
darkone238 wrote:Carnildo wrote:EvanED wrote:(As a side note, every time I read the manpage for gettimeofday I feel like the next manpage I read is going to just be the lyrics of Never Gonna Give You Up. There are two parameters, but you are required to pass NULL for the second? It returns a value which is guaranteed to be 0? Whose idea of "good API design" is this?)
Sounds like you need a better man page. Mine explains why you should pass NULL (it's obsolete functionality that has never been supported on LInux), and that it returns -1 on failure; looking at the error codes it can return, the implementation on your system may not have any failure modes.
http://pubs.opengroup.org/onlinepubs/00 ... ofday.html
Maybe the Evan was looking at this
EvanED wrote:[continuation of [notaurl=http://forums.xkcd.com/viewtopic.php?p=2880081#p2880081]this discussion[/notaurl].]darkone238 wrote:Carnildo wrote:EvanED wrote:(As a side note, every time I read the manpage for gettimeofday I feel like the next manpage I read is going to just be the lyrics of Never Gonna Give You Up. There are two parameters, but you are required to pass NULL for the second? It returns a value which is guaranteed to be 0? Whose idea of "good API design" is this?)
Sounds like you need a better man page. Mine explains why you should pass NULL (it's obsolete functionality that has never been supported on LInux), and that it returns -1 on failure; looking at the error codes it can return, the implementation on your system may not have any failure modes.
http://pubs.opengroup.org/onlinepubs/009604599/functions/gettimeofday.html
Maybe the Evan was looking at this
That's actually probably exactly what happened. For a few reasons I actually have a tendency to Google for man pages instead of just running 'man blah', and that is apparently the first hit if you do [notaurl]http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=man+gettimeofday#pq=man+gettimeofday&hl=en&qe=IGdldHRpbWVvZmRheQ&qesig=YvrQphwe6SbSaLVrhNdgbg&pkc=AFgZ2tn7D4int2HK6y4e-WazF50g7EXbnLstZQLQIZXQFgUuCDJFW73s-2nk1-gUN-es4-ly8lMUoqxmbgVrAkYERrVaXzx4wQ&cp=0&gs_id=5&xhr=t&q=gettimeofday&pf=p&sclient=psy-ab&source=hp&pbx=1&oq=+gettimeofday&aq=0&aqi=g1g-c1g2&aql=&gs_sm=&gs_upl=&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=f2e3bb8212f508f6&biw=1678&bih=942]a Google search[/notaurl] for gettimeofday().
That being said, I stand by my statement. Why would you put such a poorly-designed function in the standard? I guess I could see including it for backwards compatibility, but it should have been added and immediately deprecated, and an alternative provided which is not stupid. (clock_gettime() was added later, and at least my manpage says "is not widely supported.")
Shivahn wrote:Do I have each of the header files include a header with constant definitions? Is there some other preferred way of doing this? I'd prefer not to have each header have a definition, since missing one during a change could cause numerous bugs. They'd all be easy to fix, probably, but I'd still rather be safe than sorry...
EvanED wrote:Shivahn wrote:Do I have each of the header files include a header with constant definitions? Is there some other preferred way of doing this? I'd prefer not to have each header have a definition, since missing one during a change could cause numerous bugs. They'd all be easy to fix, probably, but I'd still rather be safe than sorry...
You have good sense. You definitely don't want to repeat definitions like that. One header with the constant values that gets included everywhere would be perfectly reasonable if you want to set your dimensions globally like that.
PM 2Ring wrote:EvanED wrote:Shivahn wrote:Do I have each of the header files include a header with constant definitions? Is there some other preferred way of doing this? I'd prefer not to have each header have a definition, since missing one during a change could cause numerous bugs. They'd all be easy to fix, probably, but I'd still rather be safe than sorry...
You have good sense. You definitely don't want to repeat definitions like that. One header with the constant values that gets included everywhere would be perfectly reasonable if you want to set your dimensions globally like that.
It's a Good Idea to put include guard macros in a header that gets included by other headers, to prevent the header from being included multiple times. FWIW, I tend to put guard macros in all my headers, just to be on the safe side.
Shivahn wrote:PM 2Ring wrote:EvanED wrote:Shivahn wrote:Do I have each of the header files include a header with constant definitions? Is there some other preferred way of doing this? I'd prefer not to have each header have a definition, since missing one during a change could cause numerous bugs. They'd all be easy to fix, probably, but I'd still rather be safe than sorry...
You have good sense. You definitely don't want to repeat definitions like that. One header with the constant values that gets included everywhere would be perfectly reasonable if you want to set your dimensions globally like that.
It's a Good Idea to put include guard macros in a header that gets included by other headers, to prevent the header from being included multiple times. FWIW, I tend to put guard macros in all my headers, just to be on the safe side.
Code::Blocks does that for me thankfully.
Which is good because otherwise I'd have SDL included like fifteen times. Which would be less than excellent.
class MyClass {
public:
void doSomething() {
blah();
blah();
}
};namespace
{
void helperFunction1()
{
...
}
}static void helperFunction1()
{
....
}ahammel wrote:Fox News is the comment section.
Even if you can switch it off and use unified deterministic resource management instead (and I suspect you can't), I don't consider that an advantage over C++. Although in that case it wouldn't be a drawback either.MHD wrote:Jplus wrote:[not enthusiastic about D]
It has builtin garbage collection
What do you mean by that? What's not real about C++' object system?MHD wrote:and an actual object system
I've heard a similar claim before, but I couldn't find any clear hints at the Digital Mars and D programming language websites on how D would be better at this than C++. Care to give an example?MHD wrote:and it has compile time programming/type manipulation that puts C++ to shame.
Does the tagging offer any advantage, apart from documentation (which you could also do with plain comments)? E.g. does it allow the compiler to do anything special?MHD wrote:It does still support pointer shenanigans and spectacularly unsafe casts, and even lets you tag code accordingly.
Not a difference.MHD wrote:It has a sensible standard library
Well that's nice, but I suspect many more libraries are available for C++ overall. It's kind of sweet to provide a big standard library, but it's not of much use if you still have less options overall.MHD wrote:and builtin things that C++ has clunky imports for.
Not a difference.MHD wrote:It can link against C code.
Oh really? Like what? I can find that D has some standard libraries which are now introduced as standard libraries in C++, such as threading and regex, but that again only obscures the fact that more libraries are available for C++ overall. The website doesn't seem to mention any core features that C++ didn't have until now (e.g. lambdas). Even if there are such things they bear little practical relevance because, well, C++ now has them too.MHD wrote:It did right from the start (1999) everything the C++11/0x tries to fix now.
Let's just face that less libraries are available for D.MHD wrote:One noticable problem is that D 2.0 haven't got a port of Tango yet.
Other things is that it lacks ports for several major C libraries too, such as GMP and many GUI libraries.
Xeio wrote:See, now I would think that "bool ValidateX(X)" would return true if X was valid.
Of course, I must be crazy to follow convention like that.


TheChewanater wrote:Xeio wrote:See, now I would think that "bool ValidateX(X)" would return true if X was valid.
Of course, I must be crazy to follow convention like that.
Sometimes in C non-zero means error and zero means success. Assuming this is C++ (or something else with a "bool" primitive), someone may have decided to carry over that convention just for consistency.
Still kind of stupid, though.
EvanED wrote:But as much as I'd like to see MSVC take up the EDG front end, I sort of doubt they will. That would break a lot of existing code, as the current MS compiler is way off spec in some respects. In particular, it doesn't implement two-phase name lookup for templates; practically speaking this leads to just being way too permissive, but it can lead to silent changes of behavior.
That said, I don't have much experience with using EDG compilers (mostly just an occasional flirt with Intel CC and the Comeau online try-it-out thing), but I actually really like MSVC's error messages. I tend to find them far more readable than GCC's. So hopefully either EDG is up-to-par (which wouldn't surprise me) or they bring it there before taking it up.
function get_user_email($id){
$q = query("SELECT `email` from `users` where `id`='".mysql_real_escape_string($id)."'");
if(mysql_num_rows($q) == 0){
return RESULT_ERROR_NOT_FOUND
}else{
return array(mysql_result($q, 0, 'email'), RESULT_OK);
}
}
function display_user_email($id){
$email = get_user_email($id);
if(is_okay($email)) echo "<div>" . $email[0] . "</div>"
}
jareds wrote:EvanED wrote:But as much as I'd like to see MSVC take up the EDG front end, I sort of doubt they will. That would break a lot of existing code, as the current MS compiler is way off spec in some respects. In particular, it doesn't implement two-phase name lookup for templates; practically speaking this leads to just being way too permissive, but it can lead to silent changes of behavior.
Just to be clear, I meant that Intellisense resembles EDG --microsoft --microsoft_bugs, not default EDG; and presumably default EDG would be named something like --strict under MSVC if they switched front-ends.
I was quite surprised to notice that Intellisense was not using the same front-end as the compiler.
Users browsing this forum: No registered users and 4 guests