Isn't that what the restrict keyword is for?
gcc mostly ignores restrict, though it's got a little better in recent versions. icc uses it a little more.
But restrict is only good in specific situations - if you have three pointers, and #2 can alias #1 but not #3, there's no way to express that.
It also tends to be used on function arguments, not at some higher up point of declaration. So when compilers inline the function and can see more global info about it, the restrict gets lost and optimization gets worse.
I think some kind of stronger 'typedef' would be better.
Yes, but how long does this exist? My guess would be that it isn't really used (yet) in ffmpeg.
Since C99 so 15 years, which is older than ffmpeg.
What I meant is how long is it supported by compilers. I know its by GCC, but I think it's not by MSCV. Is it possible to compile ffmpeg with MSVC? But ok, one could use it and just #define it away for crappy compilers.
According to MSDN, Visual C++ has supported the equivalent __restrict keyword since at least 2005 [1], and according to the ffmpeg documentation [2], "FFmpeg can be built with MSVC 2012 or earlier using a C99-to-C89 conversion utility and wrapper, or with MSVC 2013 and ICL natively."
[1] http://msdn.microsoft.com/en-us/library/5ft82fed(v=vs.80).as...
(Plus x86's intrinsics are just plain ugly. It's easier to read asm.)
As for the architecture-independent SIMD in GNU C, it's something, but not quite flexible enough. Even C is really not a good enough language to consider implementing this in, because it has an overly-conservative memory model when it comes to char *, which aliases all other memory. For a library dedicated to parsing things which come in the form of bytestreams and 8-bit pixels, this means that most compiler optimizations are defeated right in the inner loops where you'd need them.