User panel stuff on forum
  9 posts on 1 page  1
Client Talk
2007-01-01, 17:30
Member
1011 posts

Registered:
Feb 2006
vvd, just out of interest, why add the _Q suffix to the endian ifdefs? gcc3/4 automatically define __BIG_ENDIAN__ on BE architectures and __LITTLE_ENDIAN__ ON LE architectures - I don't see the point in us requiring it to be manually defined on all platforms by using this non-standard naming? if platform-specific compiler doesn't specify endian then add a define for that platform but stick to the standard names without the _Q suffix

this is important for universal binary on mac using xcode < 2.3 (i _believe_ 2.4 allows architecture specific CFLAGS - i am downloading as we speak to test) as endian detection is expected to check the standard convention of __BIG_ENDIAN__ / __LITTLE_ENDIAN__

note from this grep that we currently have the following unique ifdefs involving endian defines in ezquake src (the one missing the _q_ suffix is in gl_texture.c)

#elif defined(__LITTLE_ENDIAN__Q__)
#elif defined(__PDP_ENDIAN__Q__)
#ifdef __BIG_ENDIAN__
#ifdef __BIG_ENDIAN__Q__
#ifdef __PDP_ENDIAN__Q__

i also don't see the point in adding 'toy' support for PDP-11 endian but i guess that is just russian eccentricity :-)
2007-01-12, 11:56
Member
1011 posts

Registered:
Feb 2006
i just went ahead and fixed this in CVS as nobody replied with any acceptable reason why the __Q suffix had been added
2007-01-12, 18:59
News Writer
280 posts

Registered:
May 2006
Because this was ported from MVDSV.
Where "gcc3/4 automatically define __BIG_ENDIAN__ on BE architectures and __LITTLE_ENDIAN__ ON LE architectures" don't work, for example, on some SunOS 5.8/9 UltraSparc64.
MVDSV on PDP-11 - who know... :-)
And I made endian support same in MVDSV and in ezQauke.

$ cat test.c
#include <stdio.h>
int main()
{
printf(
#ifdef __BIG_ENDIAN__
"__BIG_ENDIAN__\n"
#elif defined(__LITTLE_ENDIAN__)
"__LITTLE_ENDIAN__\n"
#else
"NO\n"
#endif
);

return 0;
}
$ gcc -o test test.c
$ ./test
NO
$ uname -mrs
FreeBSD 5.5-RELEASE-p2 i386
$ gcc --version
gcc (GCC) 3.4.2 [FreeBSD] 20040728
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Don't work. :-\
2007-01-12, 19:03
News Writer
280 posts

Registered:
May 2006
P.S. In Russia days from Dec 31 to Jan 8 are holidays.
I only today "open" qw.nu forum - too many work after holydays and have no internet at home. :-(
2007-01-13, 13:22
Member
1011 posts

Registered:
Feb 2006
VVD wrote:
Because this was ported from MVDSV.
Where "gcc3/4 automatically define __BIG_ENDIAN__ on BE architectures and __LITTLE_ENDIAN__ ON LE architectures" don't work, for example, on some SunOS 5.8/9 UltraSparc64.
MVDSV on PDP-11 - who know... :-)
And I made endian support same in MVDSV and in ezQuake.

but this is not an answer

OK some gcc on some architectures don't automatically define the endianness, but why choose a non-standard naming convention? Just make all architectures define/redefine __BIG_ENDIAN__ or __LITTLE_ENDIAN__
2007-01-16, 15:33
News Writer
280 posts

Registered:
May 2006
$ cat /usr/include/machine/endian.h
...
#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
...

Can u to guarantee what no arhitectures with "#define __LITTLE_ENDIAN__ 1234" and etc. ?
Or u propose to do:
#ifdef __LITTLE_ENDIAN__
#undef __LITTLE_ENDIAN__
#ednif
#ifdef __LITTLE_ENDIAN__Q__
#define __LITTLE_ENDIAN__
#endif
...
Or? Ur variant?
2007-01-16, 15:39
News Writer
280 posts

Registered:
May 2006
http://mvdsv.cvs.sourceforge.net/mvdsv/mvdsv/configure?revision=1.13&view=markup&sortby=date
2007-02-01, 14:39
News Writer
280 posts

Registered:
May 2006
Let project managers choose "correct" way.
In MVDSV I don't want to change this.
2007-02-01, 19:23
Member
1435 posts

Registered:
Jan 2006
Let's stay with non-Q variant. There's a good point for MVDSV to have his own Q-ed version in there, ezQuake doesn't have as many target platforms as MVDSV though.
  9 posts on 1 page  1