News for hackers. Stuff that matters.
Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @10:38AM (#11110511)
Apparently until the UNIX culture that worships C exist, it won't happen.

C only became a thing in computing after UNIX workstations became popular.

Before it, there were quite a few safer systems programming languages to choose from, that got steam rolled by C adoption in OS SDKs.

Due to its relation with UNIX, it will most likely happen with Apple (Swift), Microsoft (.NET Native, System C#, C++/GSL), Google (Java FTW on Android, Go) than any other OS vendor.

But I am also looking forward any of them pick D, Rust, <whatever safe lang> in the process.

Re:Glibc getaddrinfo stack-based buffer overflow by IgorPartola on Tuesday February 16, 2016 @11:07AM (#11110753)
> Java FTW on Android

This made me smile. Need I point out that Android runs on top of Linux? Or that you can still use C/C++ on Android? http://developer.android.com/tools/sdk/ndk/index.html

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @11:27AM (#11110934)
Yes and I use it.

I also feel the pains that Android teams imposes on the NDK users to use it as little as possible.

If you bothered to read the contents of the link that you pushed.

"Notably, using native code on Android generally does not result in a noticable performance improvement, but it always increases your app complexity. In general, you should only use the NDK if it is essential to your app—never because you simply prefer to program in C/C++. When examining whether or not you should develop in native code, think about your requirements and see if the Android framework APIs provide the functionality that you need"

Also Android Java is nowadays AOT compiled to native code. So whatever C and C++ dependencies there are, could certainly eventually be replaced if there were willingness to do so.

Besides, have you ever tried to implement libc in ANSI C, without language extensions and a sprinkle of Assembly?

Re:Glibc getaddrinfo stack-based buffer overflow by IgorPartola on Tuesday February 16, 2016 @11:37AM (#11111021)
Nonetheless, it's something that is available to you as a developer. I am firmly in the "right tool for the job" camp, and I can see situations where C is the better tool. I don't see why mobile app development would benefit from it, but I almost never have the opportunity to work with Android.

I have never attempted to put together a full libc in ANSI C, no. My experience there is limited to putting together parts of it for various microcontrollers, where I was more or less bound to ANSI C and chose to use no assembly.

That's a long way of saying, what's your point? And why do you feel the need to get personal?

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @11:53AM (#11111188)
Excuse me if it felt personal it wasn't my intention, just the way I write.

Non native speaker here.

As I mentioned in the reply and in another thread, I do use the NDK, but I wouldn't if there were better alternatives.

30 years ago those microcontrollers would probably be programmable in Assembly and Forth, Pascal, Basic and C dialects. At least when I think about Z80 like ones.

Re:Glibc getaddrinfo stack-based buffer overflow by lmm on Tuesday February 16, 2016 @11:53AM (#11111184)
Just because it's not perfect doesn't mean it's not better. Yes Android runs x000 lines of C and that's x000 lines too many, but it's still a substantial improvement over desktop systems.
Re:Glibc getaddrinfo stack-based buffer overflow by tosseraccount on Tuesday February 16, 2016 @11:29AM (#11110946)
... and apple runs of top of BSD.

C popularity pre-dates workstations. DEC (Digital Equipment Corporation ) , maker of popular mini computers, used it extensively.

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @11:37AM (#11111035)
I only bothered to use C when forced into UNIX world via Xenix.

Yes Apple runs on top of BSD, because they weren't able to write a new OS and had to buy one, which happened to be built on top of BSD.

Once upon a time they had their OS written in Object Pascal, but then they decided to rewrite it in C to welcome those UNIX devs.

Nothing prevents them to rewrite parts of the OS in Swift after the language gets more mature.

It is only a question of willingness, political will and money.

Re:Glibc getaddrinfo stack-based buffer overflow by mikeash on Tuesday February 16, 2016 @12:52PM (#11111729)
What Apple OS was written in Object Pascal? It looks like they had an app framework written in that language, but the OS never was. I believe the Mac OS at the time was predominantly written in assembly, possibly with some (non-object) Pascal parts.
Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @01:55PM (#11112214)
Mac OS, the initial versions.

It was a mix of Object Pascal and Assembly. The Pascal extensions that Borland later adopted in TP 5.5.

Re:Glibc getaddrinfo stack-based buffer overflow by mikeash on Tuesday February 16, 2016 @02:00PM (#11112248)
The initial versions were pure assembly. There was no room for any high-level code. As time went on and more storage was available, that became a possibility, but much of the OS remained assembly. This was a big part of why so much of the OS ran under emulation when the PowerPC Macs were introduced.
Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @03:52PM (#11113039)
Well here there is a bit of different story being told.

http://www.folklore.org/

Search for Pascal.

Cherry picked from the search results

http://www.folklore.org/StoryView.py?project=Macintosh&story...

The fact that many C programmers forget, is that it is impossible to implement the C runtime or an OS with pure ANSI C code.

Somehow it is ok for C to use Assembly and compiler specific extensions, but not for other systems programming languages to do the same.

Re:Glibc getaddrinfo stack-based buffer overflow by mikeash on Tuesday February 16, 2016 @03:57PM (#11113077)
Nothing in that link says that the OS was written in Pascal. Yes, Pascal was a popular language for Mac apps, but of course nothing says that the OS has to be written in the same language used for writing programs that run on it.

I don't understand your last comment. I am not saying that the OS doesn't qualify as "written in Pascal" because it contains assembly. I am saying it doesn't qualify because it didn't contain Pascal. The early versions were subject to absurd space constraints that required everything to be written in assembly. My understanding is that high level languages started to be used for parts of the OS later on, but it remained predominantly assembly until well after the PowerPC transition.

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @05:09PM (#11113511)
Well, I was kind of right and you as well.

It was the Lisa that was written in Pascal.

http://www.folklore.org/StoryView.py?project=Macintosh&story...

Re:Glibc getaddrinfo stack-based buffer overflow by mikeash on Tuesday February 16, 2016 @12:48PM (#11111691)
I wouldn't say that UNIX workstations became truly popular until after Mac OS X took off sometime in the 2000s. C and C++ were enormously popular in the 90s, if not earlier. They were really common for Mac and Windows programming, and I don't think that had anything to do with the UNIX connection.
Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @01:52PM (#11112191)
I was there.

The only reason to get a C compiler for CP/M, MS-DOS or Amiga was to be able to bring work home from those expensive workstations at work or university.

Re:Glibc getaddrinfo stack-based buffer overflow by mikeash on Tuesday February 16, 2016 @02:02PM (#11112266)
CP/M, MS-DOS, and Amiga sound like the 80s, not the 90s. I recall that C was not super popular at that time (I arbitrarily chose to start learning Pascal around 1988, given a choice between C and Pascal, probably the wrong choice in hindsight) but by the early/mid 90s it was pretty huge.
Re:Glibc getaddrinfo stack-based buffer overflow by marshray on Tuesday February 16, 2016 @03:23PM (#11112865)
I was there too. C was a common language for developing from-scratch DOS applications in the 1980's. Sometimes portability was a consideration, often not. Mark Williams and Microsoft C were two popular compilers.
Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @03:45PM (#11113006)
Microsoft C before Visual C++ being popular?!

Not on my country, it was all about Borland compilers, even in the Windows 3.x days.

Microsoft was even the last vendor to add support for C++ on the last MS-DOS version of Microsoft C, version 7 if I remember correctly.

Re:Glibc getaddrinfo stack-based buffer overflow by marshray on Tuesday February 16, 2016 @03:58PM (#11113079)
Yes, Borland "Turbo" C was another massively popular choice.

But you can't simultaneously argue that C wasn't used for PC platform development in the 1980's and that Borland C was dominant.

Re:Glibc getaddrinfo stack-based buffer overflow by pjmlp on Tuesday February 16, 2016 @05:05PM (#11113492)
> it was all about Borland compilers

I never said directly I was referring to Borland C, actually it was all about Turbo Basic and Turbo Pascal.

I and a few others did use Turbo C, but we jumped right into Turbo C++ the year thereafter, as we could not envision using plain C after having done systems programming in the other Borland languages.

C was left for programming classes, usually trying to convince the teacher to use C++ instead for projects, sadly it only worked occasionally.