Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×

Comment Re:D is a regression (Score 2) 386

A preprocessor is the only way to ignore syntax errors.

Here's how to break your compile even when UNTESTED_FEATURE is undefined:

/* crazy_new_untested_code.c */
#endif /* now what? */
...

The preprocessor can't save you from developers who check in uncompilable code. I'd argue it makes the situation worse: overuse of the preprocessor makes breaking the build easier than ever and makes figuring out why it doesn't build no fun at all. Use a branch in your version control for that.

Here's your mystructure example in D:

struct mystructure { int one; static if(GREATFEATURE) int two; };

How simple is that? Sadly, C++ doesn't have static if yet, but the D implementation proves you don't need a preprocessor for that. I was going to show how to do that in C++ with partial specialization, but it's obvious you don't care and nothing is going to convince you that the preprocessor is evil :)

That's fine, you can keep it.

Comment Re:D is a regression (Score 1) 386

You don't need a preprocessor to have conditionally compiled code. C# supports your use-case (producing different code depending on symbols being defined) without a preprocessor, and many other languages do too. C++ has basically eliminated the need for every use of the preprocessor except #include with inline functions, constexpr functions, const variable declarations or template functions. The preprocessor is the worst thing about C++, but getting rid of it would be the mother of all breaking changes. The module proposal would eliminate #include, at least for new code.

The preprocessor makes code harder to understand, very hard to parse, and makes things like refactoring tools, static analysis tools, etc. much harder than they should be. There are damn good reasons why no language since C/C++ has reinvented the preprocessor: it sucks.

If you really need a code generator, use a code generator. The preprocessor isn't well suited for that either.

Comment Re:The thing about new languages... (Score 2) 386

length of an array was part of its type

The size of a statically allocated array simply is part of it's type. It's size is known at compile time, it can be allocated on the stack, or embedded in a structure without a pointer (keeping memory contiguous, without dynamic allocation, and without creating an incidental data structure.) All of which is indispensable for systems programming. It's a feature not a bug. Maybe it was a design error to make that the default array type, but simply having it is not a bug.

Comment Re:c++11 does it in (Score 2) 386

You can use D without automatic garbage collection, but most of the system libraries depend upon it. The two main language designers are working on an architectural change so you can use the system libraries with or without garbage collection as you choose.

I really wanted to like D, but the dependence on the garbage collector is a deal-breaker. That's a pretty big oversight for a language trying to compete with C++. It makes me wonder how well they've thought out using different subsets of the language without paying for what you don't want, which is one of the reasons for using C++.

Yes it would be nice to have a C++ with a cleaner syntax, but C++11 is already a huge improvement, and C++14 will be even better. If we can finally get concepts, it'll be amazing. In fact, C++ is innovating faster than D is.

Comment Re:COBOL (Score 2, Insightful) 386

C++ is an underrated programming language. The central organizing principle of C++ is that you only pay for what you use. Don't need garbage collection? Don't use one. Don't need exception handling? Don't use them. Don't need RTTI? Don't use it. Etc, etc. If you want to use it like C, but with a few syntactic niceties, you can. It may be a "kitchen sink" of programming languages, but that's a feature if you can use what you want without paying for what you don't want. Despite all the complaints and trash-talk, it's popularity is well-deserved.

Comment Re:More people should be serious about this (Score 1) 136

It's not like drug-resistant bacteria are going to rise up and kill us all at once some day in a weird, snotty epidemic...

Actually, it may be like that...

I find it ironic that in spite of our ridiculous survival advantage over nearly every other species, it's the most biologically simple ones that have a real chance of taking us out.

Comment Re:Someone teach me something here... (Score 0) 360

what if its all a lie, and we make the world a better place for nothing?

You have no idea how irritating statements like that are. I'm supposedly on your side, but your reasoning is just bullshit. You're not being clever, you're just being ignorant.

If climate change were a lie, then taking the drastic efforts necessary to do something about it would not be making the world a better place. You seem to think there is no economic cost in dealing with climate change -- that there are no sacrifices to be made. But if that were true we wouldn't be having these heated discussions.

Try to get your head around this one fact, because it's one thing the "other side" is right about: Dealing with climate change is going to itself be a huge economic disaster, and people will suffer because of it.

The question is will it be less of a disaster than not dealing with it.

Comment Re:Before reading TFA ... (Score 1) 245

For various reason having to do with the instruction set, x86 and x86-64 code is impossible to verify as safe to run. Google Native Client gets around that with a combination of static analysis and an execution sandbox (separate from the sandbox chrome already uses.) That's pretty close to what you're asking for, but afaik only works in chrome. It supports x86-32, x86-64, and ARM.

It's complicated imo: many processes involved with a single browser tab, with lots named pipes, all branch instructions have to be thunked, requiring a lot of overhead for branches. You also have to have compiler support. Google only supports C/C++. There are third party tools for Lua, Python and Ruby, and some work is being done that would allow you to use any language that can target LLVM's intermediate format.

The lack of browser support is the biggest problem though.

Comment Re:I no longer think this is an issue (Score 1) 258

it doesn't sound too hard for an AI to figure out that if it dies, then it will be difficult to do well on its other goals.

Humans don't even always do this. Many people are willing to die and have died for some abstract cause.

Self-preservation is the highest level goal, and takes priority over any other possible goal. The catch is that "self" is itself an abstract concept. To the extent that I conflate my concept of self with some abstract cause, I am willing to die for that cause. If the cause lives on, so do I, because I believe in some way that I am that cause. If the cause dies, "I" die.

An Artificial Intelligence with a self-preservation instinct and an abstract concept of self could be just as willing to sacrifice itself for humanity as a soldier is.

Comment Re:Transient skills (Score 1) 135

the level of effort to actually generate an exploit that works regularly is the point of diminishing returns

You would think so, but experience has shown that without a working proof of concept exploit, software vendors dismiss the vulnerability as theoretical, downplay the severity, or outright ignore it. Sometimes they even ignore vulnerabilities with working exploits, if it isn't actually being exploited in the wild (that anyone knows about). And a working exploit is useful for testing your own systems.

Comment Re:Shrug (Score 1) 161

XHTML serves a purpose. It adds the eXtensibility so that XHTML can be encorporated into other XML documents and visa versa, and it allows you to parse, generate and manipulate it with XML tools. The fact that browsers still have to deal with non-XML HTML doesn't take away from it's advantages.

If you're generating HTML, there's no reason to not generate XHTML -- it's only the code that consumes it that has to deal with HTML. And what, besides a browser, consumes HTML? (Whatever it is, it's probably doing it wrong.)

Comment Re:Free? (Score 1) 703

Absolute moron or not, I think you misunderstood him.

Prices are determined by where willingness to pay meets willingness to sell. Subsidies raise the willingness to pay and therefore raise prices.

That comment makes sense if "Subsidies" means money given to the student to pay tuition, which he's claiming raises the willingness to pay. I assume that's the correct interpretation, since that's what TFA is about. You're talking about subsidies given to the school, which by the same logic would raise the willingness to sell.

So there are subsidies on both the supply and the demand side. I'm pretty sure the subsidies to the schools (supply side) completely dwarf the subsidies given to the students (demand side), and this proposal would have little effect.

But the premise "prices are determined by where willingness to pay meets willingness to sell" is flawed anyway:

  • 1. Community College tuition is usually set the state legislature, so there's that.
  • 2. International enrollment is high and increasing, and would be even higher if it weren't limited by policy. International tuition is double or triple what in-state students pay, so we already know tuition is kept low despite high demand.
  • 3. Most private money also goes to the supply side. That's why University of Washington has "The Paul G. Allen Center for Computer Science & Engineering."

Slashdot Top Deals

Refreshed by a brief blackout, I got to my feet and went next door. -- Martin Amis, _Money_

Working...