Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?
Check out the new SourceForge HTML5 internet speed test! No Flash necessary and runs on all devices. ×

Comment Re:So what? (Score 1) 273

Categorising one of the most important images of the 20th century with child pornography is a problem. A big one.

Except it is not pornography. Pornography is defined as printed or visual material containing the explicit description or display of sexual organs or activity intended to stimulate sexual excitement.

Now if somebody really believes a photo of napalm victims is intended to stimulate sexual excitement, then I agree this person might have some big problems indeed.

Comment Re:Readability wins every time (Score 1) 239

Speaking of readability, here's an entertaining one I've been seeing more of in C:

if (result == SUCCESS) versus if (SUCCESS == result)

The rationale behind the second is that you don't end up accidentally assigning SUCCESS to result (eg, if (result = SUCCESS)). But I know that I find it weird to look at it the other way around. I want to know if the result was successful, not if successful was the result. Maybe it's an english thing.

I know that Xcode has been putting up warnings/errors for code that does assignments in if-statements and saying that if you really want to do that, wrap it in an extra layer of parentheses (eg, if ((booleanResult = Do_Something()))). I'm not sure this is somehow more clear that you're doing the assignment...

In proper C++ this would be

if (bool booleanResult = Do_Something()) {

or more usefully

if (AClass foo = PrepareFoo()) { DoSomethingWith(foo); }

This does not generate those assignment warnings, is in the right order for readability and does not need obscure extra parens.

Comment Readability wins every time (Score 1) 239

In professional software development, the general idea is clear: if any non-functional change in a source code file makes it more readable and more maintainable, then it's good, and vice versa. You write the thing once and it has to be maintained for years. This is actually called code refactoring, which is part of several methodologies.

Code refactoring may mean either adding or deleting code. There ought to be a golden middle point somewhere where the code is neither too verbose nor too condensed.

There is a slight complication in that not every person agrees what is the most readable form for a program, but in general it's best to imagine that you may have a total autobiographical amnesia in the next day and still need to understand what the program does.

Comment Re:Missing features (Score 1) 286

So, memcpy() does not work in C++? Did not know that.

Or strcpy() for that matter? Ah: you want to imply that one should use std::string?

Sorry, regarding buffer overruns C++ is as vulnerable as C.

memcpy() and strcpy() are not found in proper C++ programs (there is no need for them).

Anyway, memcpy is not the cause for buffer overruns. Buffer overruns appear when two pieces of code get confused about what is the actual size of the buffer. In C++, the actual size is stored right there inside the buffer object (e.g. std::vector or std::string), so the probability of confusion is greatly reduced.

strcpy() is vulnerable because it relies on the buffer size stored somewhere else in addition to the buffer management (i.e. malloc()), and these two locations may get inconsistent and cause confusion and bugs. Luckily, there is about zero reason to use strcpy() in C++.

Of course one can compile what is basically C code by a C++ compiler, but this does not mean one could not do better in C++, or that C++ is somehow tainted by allowing C code. One can write buggy code in any language, writing buggy C code in C++ is just one easy way to do that.

Comment Re:Missing features (Score 1) 286

Nevermind managed execution to avoid buffer overruns and other "memtrashing" failures that have been a huge security clusterfuck over the last few decades...

I believe you have mixed up C++ with some other language. C++ does not have any such buffer overrun issues (unless you treat it as "C with classes", of course).

Submission + - Even Einstein doubted his gravitational waves (

Flash Modin writes: In 1936, twenty years after Albert Einstein introduced the concept, the great physicist took another look at his math and came to a surprising conclusion. “Together with a young collaborator, I arrived at the interesting result that gravitational waves do not exist, though they had been assumed a certainty to the first approximation,” he wrote in a letter to friend Max Born. Interestingly, his research denouncing gravitational waves was rejected by Physical Review Letters, the journal that just published proof of their existence. The story shows that even when Einstein's wrong, it's because he was already right the first time.

Comment Re:This is the least of the problems with SO. (Score 1) 303

I was having a debate with several high ranking programmers on SO about needing to mark an INT volatile or having to use Interlocked atomic writes to make sure the class variable gets flushed to memory after the method call finishes.

Indeed, there is no need for that. You need to sync only if something must get visible to another thread.

My argument is that unless the method discards the data or inlines the method call, the method has to eventually flush the data from registers back to memory before returning control.

As written, this statement seems indeed either insane or tautological. I am not surprised SO people were baffled.

Now that .Net code is on GitHub, it turns out Microsoft's own code for stuff like semaphores are written exactly the way I proposed.

A semaphore is a totally different thing than an ordinary user-defined class object.

Comment Re:Bring More Solutions than just One (Score 2) 74

Perhaps you could give an example of Open Source software you think needs a special class of user called "tinkerer"?

Try compiling three year old scientific software written in academia without either a programmer or a sysadmin (either should fulfill the role of "tinkering" with software).

I know the sentiment. The only thing worse than open-source software from academia is closed-source software from academia. We ended up putting it in a separate background process so when it crashes we can try to run it again a couple of times.

Making some program open-source does not magically increase its quality, and being in academia does not magically turn professional scholars into professional programmers. Nothing new here.

Comment Doctors are no different (Score 2) 397

In the article there are a lot of comparisons to doctors. Like, how you can become a doctor by spending 7 years in a medical school, etc, whereas in programming you do not have a clear path.

To my mind, this only proves that nobody really questions the qualification of the doctor. The patients are (or considered to be) not qualified to do that, so unless you are very bad, you can carry out a successful doctor career without really mastering the skills. I am sure in no way can all people become good doctors if they spend 7 years in medical schools, and the same applies to programmers. The only difference is that for a computer program it is much easier to see if it works and who is responsible when it doesn't.

Comment Re:Need more mature languages (Score 1) 232

C/C++ is not suitable for anything which should never crash or return random results due to memory corruption.

Yes, it's 2015 and so it would be appropriate to realize that C and C++ are two totally different languages (where one of those is just capable to seamlessly compile most of the code written for the other).

Slashdot Top Deals

Base 8 is just like base 10, if you are missing two fingers. -- Tom Lehrer