Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×

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 (astronomy.com)

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).

Submission + - NATO STRATCOM: Fearmongering on refugees spread by 'third parties' (politicsforum.org)

paavo512 writes: Upon examining the information flow about the refugees' way to Europe, the NATO Strategic Communications Center of Excellence (StratCom) has noticed that the information shows signs of having a coordinated strategy, leading to thoughts about third parties trying to divide European society.

"We have a hypothesis that there is a noticeable, coordinated strategy [of influencing the information flow] — we have started comparing the situation in Lithuania, Latvia and Finland, and there are many parallels," said Janis Sarts, head of the StratCom.

He added that he currently has no information about the possible perpetrators of these disruptions. "But it is obvious that this information is splitting society, and it is splitting Europe," he said.

Comment Re:No. Solicitor General's Office is Good (Score 1) 223

They are for the most part really top-tier professionals who are trying to make the decision based on what is best for the US Government as an institution. Not influenced very much by politics. They are widely considered the "tenth justice," and really care about (1) whether the case is important, (2) whether the case presents the issues it's about well (i.e. is it a good vehicle for the issue), (3) whether the case has facts that are favorable for getting to what the government thinks is in its interest, etc...

Well, in this case they have clearly failed as the case is obviously very important (can overturn the whole concept of SDK-s) and is pretty clear-cut. So it appears the government thinks it's in its interest to sink the whole digital revolution. Well, considering that a moderate AI might perform better in their jobs, they might be right...

Comment It's not that hard. (Score 3, Interesting) 298

Good code has documentation for knowing what it should do, and has unit tests to verify that it actually does that. If there are any problems good code can be modified to meet the (possibly changed) requirements better, while unit tests ensure the modifications do not make the code worse. Code which cannot be modified is not good code. It's that simple.

Slashdot Top Deals

You are in a maze of little twisting passages, all alike.

Working...