SDL 2.0 ABI locked

[…]
Assuming SDL is meant to be compatible with the earliest C standard,
C89, then assuming stdint exists is bad behavior.

OK, let me be the Devil’s advocate. Why should it target C89? It is
a library released now, targeting devices which were not even dreamt
of in '89.

As a matter of fact, you arbitrarily say C89. How about the C before
that? You know, the one without function prototypes. Why do you assume
that I use anything more than the original K&R book, which was the
de-facto C standard back then? I might even fancy the original C, where
+= was =+ (which caused a parsing ambiguity but was fixed before the
first K&R book, so it’s not well known), how about that?

I am actually serious. Why do you draw the line at 24 years? Why not
anything before? I most certainly have programmed in C way before
ANSI-C (aka C89) came out. I might even have some old C compiler
incarnations somewhere, although I could not run them without some
emulator, even if I could find an old floppy drive and built an
interface card to actually read them.

I’m all for backward compatibility and really hate when old programs
don’t run on new systems, especially when the new system is supposed
to be functionally identical and backward compatible.

However, SDL 2.0 is a new library, which is not backward compatible
with its old incarnation, despite the similarities. The lack of
backward compatibility is explicitly stated as an intentional decision.
Thus, I think the library can set the minimum acceptable HW, OS and
compiler level to whatever is deemed practical. SDL-1.2 is still there,
if you need true backward compatibility. If you want HW accelerated
rendering and OpenGL stuff, then you have to pay the price of using a
compiler not older than 14 years.

ZoltanOn Sun, 17 Mar 2013 17:29:35 -0700 “Nathaniel J Fries” wrote:

If every library defined the stdint types in the case of missing stdint.h, every library’s header would conflict
That’s why we have HAVE_STDINT_H define for. And I note again that SDL
already defines stdint.h types and SDL types are just aliases for
them. So removing SDL integer types has nothing to do with conflicts
in multiple stdint.h types declarations.On Tue, Mar 19, 2013 at 4:59 PM, Zolt?n K?csi wrote:
On Sun, 17 Mar 2013 17:29:35 -0700 “Nathaniel J Fries” wrote:

[…]
Assuming SDL is meant to be compatible with the earliest C standard,
C89, then assuming stdint exists is bad behavior.

OK, let me be the Devil’s advocate. Why should it target C89? It is
a library released now, targeting devices which were not even dreamt
of in '89.

As a matter of fact, you arbitrarily say C89. How about the C before
that? You know, the one without function prototypes. Why do you assume
that I use anything more than the original K&R book, which was the
de-facto C standard back then? I might even fancy the original C, where
+= was =+ (which caused a parsing ambiguity but was fixed before the
first K&R book, so it’s not well known), how about that?

I am actually serious. Why do you draw the line at 24 years? Why not
anything before? I most certainly have programmed in C way before
ANSI-C (aka C89) came out. I might even have some old C compiler
incarnations somewhere, although I could not run them without some
emulator, even if I could find an old floppy drive and built an
interface card to actually read them.

I’m all for backward compatibility and really hate when old programs
don’t run on new systems, especially when the new system is supposed
to be functionally identical and backward compatible.

However, SDL 2.0 is a new library, which is not backward compatible
with its old incarnation, despite the similarities. The lack of
backward compatibility is explicitly stated as an intentional decision.
Thus, I think the library can set the minimum acceptable HW, OS and
compiler level to whatever is deemed practical. SDL-1.2 is still there,
if you need true backward compatibility. If you want HW accelerated
rendering and OpenGL stuff, then you have to pay the price of using a
compiler not older than 14 years.

Zoltan


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

OK, let me be the Devil’s advocate. Why should it target C89? It is
a library released now, targeting devices which were not even dreamt
of in '89.

It’s a legitimate question, so I’ll give you a legitimate answer: SDL
1.2 targets C89–more or less–because there wasn’t any system that
had C99 support at the time.

Even now, SDL 1.2 still supports systems that don’t offer C99 (like
BeOS, which married itself to gcc 2.95’s ABI, other embedded devices, etc).

To the Devil’s Advocate point: Kernighan and Ritchie C was not what
reasonable compilers targeted, even many years before SDL 0.1. And
anyone that’s pushed zlib through clang will tell you: it’s getting hard
to compile K&R-style code now.

For SDL2, we’re obviously focused on more modern platforms, but most
Visual Studio installs do not have stdint.h, and the latest version of
Visual Studio still does not support C99, stdint.h or not.

This is why you’re starting to see “//” comments creep into SDL2 (C99
and Visual Studio support them), but not, say, variables declared in
the middle of a function.

But mostly, we’re not religious about targeting a specific C standard.
We go with the tradeoff of what works and what makes the codebase nicer,
and that tradeoff changes over time.

–ryan.

If we’re going to complain about C89 let’s also complain about
targeting C99 instead of C11…

2013/3/19, Ryan C. Gordon :>

OK, let me be the Devil’s advocate. Why should it target C89? It is
a library released now, targeting devices which were not even dreamt
of in '89.

It’s a legitimate question, so I’ll give you a legitimate answer: SDL
1.2 targets C89–more or less–because there wasn’t any system that
had C99 support at the time.

Even now, SDL 1.2 still supports systems that don’t offer C99 (like
BeOS, which married itself to gcc 2.95’s ABI, other embedded devices, etc).

To the Devil’s Advocate point: Kernighan and Ritchie C was not what
reasonable compilers targeted, even many years before SDL 0.1. And
anyone that’s pushed zlib through clang will tell you: it’s getting hard
to compile K&R-style code now.

For SDL2, we’re obviously focused on more modern platforms, but most
Visual Studio installs do not have stdint.h, and the latest version of
Visual Studio still does not support C99, stdint.h or not.

This is why you’re starting to see “//” comments creep into SDL2 (C99
and Visual Studio support them), but not, say, variables declared in
the middle of a function.

But mostly, we’re not religious about targeting a specific C standard.
We go with the tradeoff of what works and what makes the codebase nicer,
and that tradeoff changes over time.

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Well this is really awesome news. Thanks to Andre Leiradella for the stdint.h link.

Lazy Foo’ wrote:

So with this latest development, what’s currently in the way between this getting locked and the SDL 2.0 release?

I’ve been dabbling around in SDL 2.0 for the past few months and I’ve begun the process of upgrading my tutorial set in anticipation for the release. I’d like to know if I’m going to be crunching during what little free time I have on the weekends.

Excellent! It was with your tutorials that I first learned how to use old SDL! :slight_smile:

Zolt??n K??csi wrote:

OK, let me be the Devil’s advocate. Why should it target C89? It is
a library released now, targeting devices which were not even dreamt
of in '89.

As a matter of fact, you arbitrarily say C89…

Except many compilers aren’t C99-compliant, even now. That’s what kicked this discussion off.
But just about every compiler is at least C89-compliant.------------------------
Nate Fries