Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
Trust the World's Fastest VPN with Your Internet Security & Freedom - A Lifetime Subscription of PureVPN at 88% off. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. ×

Comment Re:Oh please (Score 1) 142

The type of "hello world" is const char *, so your compiler should warn that you're dropping the const in an implicit cast (and if you're a sensible person and compile with -Werror, then your compiler will reject the code). You can get the behaviour that you want with:

const char s[] = "hello world";

This will copy the contents of the string literal into a mutable array. If you write this at the global scope, the copy will be done at compile time, so you'll end up with the string in the data section, not the rodata section (if you do it in a variable with automatic storage, you'll get a copy every time the variable comes into scope). Putting constant strings in the rodata section is important for optimisation, because it allows them to be coalesced. If you write "hello world" in two place, then you'll end up with a single string in the rodata section. With some linkers, if you also write "world" somewhere else, then you'll just get two pointers into the same string (this is also one of the reasons that C uses null-terminated strings: you can't do this with Pascal strings, and it saved a useful amount of memory on the PDP-11). Once you're sharing the string, it becomes a really bad idea to allow someone to modify it, because that modification will then become visible in a different bit of code.

Comment Re:Oh please (Score 1) 142

That's pretty common for OO languages (or, in fact, any language with a notion of subtyping), where individual classes implement their own comparison operators. In C++ you can overload the comparison operators, but most OO languages that don't do operator overloading just use a named method. If you write a.equals(b), then you'll call the equals method implemented by the class of a. If you write b.equals(a) then you'll call the method implemented by the class of b. One may know about the other, but the converse is not guaranteed. The Objective-C collection classes document certain invariants for inserting objects into sets (or as keys in a dictionary), including that [a isEqual: b] implies [b isEqual: a] (and that [a isEqual: b] implies that [a hash] equals [b hash]), but this is impossible to statically verify in the general case.

Comment Technology Disruptive like Wars/Catastrophes (Score 2) 178

Yes, technology levels the playing field.

That is because, like major wars and catastrophes, it can devalue established wealth and power and empowers others to succeed based on their ability. The great thing about technology though is that it usually does this with far fewer people dying and it does not require wars to spur it on even though they often do.

Comment Re:Marketers are idiots (Score 1) 47

Apple hasn't just been talking about this, they've implemented this for a while. Many of their devices take a physical SIM and also contain an eSIM, so you can have the SIM for your home network in their physically, but when you travel abroad you don't need to physically buy a local SIM to use for a week, you just pull up the settings screen and buy a short-term plan from one of a variety of different providers.

Comment Re:This is an OS (Score 2) 156

Try deleting all of your Google cookies and visiting YouTube. You can't even watch a video until you've clicked through a bunch of T&Cs explaining that you agree to their data collecting and sharing. There's a button at the bottom saying 'I agree' and another saying 'other options', if you click on the second one, then you get to a big page full of text that basically boils down to 'sucks to be you.' If you create a Google account, then you can somewhat restrict what they'll collect to anonimised, but there's a load of research showing that basically any form of anonimised data can be deanonimised by combining it with other data sets (which, by coincidence, Google also collects).

Comment Re:Next disaster will be smartphones and headphone (Score 1) 274

Repair manuals won't help with mobile phones. They're rarely thrown away because of hardware issues. It's far more likely that they will be thrown away because they are no longer getting software updates. In the case of iOS and some Android devices, a locked bootloader prevents third parties from supporting them, in the case of most Android devices there's no financial incentive for longer-term support so no one does. For example, I have an old HTC Desire that still works fine. It's a bit underpowered, but still runs a lot of modern Android apps. Unfortunately, the last CyanogenMod build for it is based on Android 2.3, which includes an old TLS stack that only supports versions of the protocol and cypher suites that are now not supported by servers because of known vulnerabilities. This means that it can't connect to any HTTPS URL, for example. I can install F-Droid on it, but F-Droid can't fetch the repositories over HTTPS. I can side-load applications, and as long as they don't use TLS (or ship their own TLS implementation), they work fine. It probably has several other known vulnerabilities though.

At least with CRTs, replacing them with a modern LCD will cut the power consumption by a huge amount (20-50W, vs 100+W), so there's a good reason for using the newer technology. A 7-year-old Android phone is about as capable as a low-end budget phone now, yet became effectively unusable after about 4 years of life.

Comment Re:Reckless endangerment (Score 1) 196

It varies a lot by state (and even more outside the US). The intent to kill isn't a hard requirement for attempted murder - sometimes the line is drawn at an intentional action that could reasonably cause death. Seems like the sort of charge an ambitious prosecutor might try on.

Also worth noting: if maliciously calling in a fake 911 call is a felony, then in most states it would be murder if someone actually died as a result.

Slashdot Top Deals

UNIX is hot. It's more than hot. It's steaming. It's quicksilver lightning with a laserbeam kicker. -- Michael Jay Tucker

Working...