Advertisement

What is the most bizar syntax you have ever written?

Started by December 05, 2000 03:34 PM
19 comments, last by Marsupial Rodentia 23 years, 6 months ago
Recently I implemented a simple file parser for my script files. The code got tricky when I used pointers to __thiscall member functions, and then made the function call via those pointers.
  
// My.h

#define NUM_FNS 3

struct CMyClass : public CSomeBase 
{
        // Pointer to member function

        // Here is the bizar syntax

	typedef bool (CMyClass::* PTHISFN)( void );

        // Struct to hold the pointer

	struct FnCallEtAl					
	{
                int nSomeKindOfId;
		PTHISFN pFn;
	};

        // Static member (array of function pointers) 

	static FnCallEtAl MyMemberFns[NUM_FNS];

        // Member function that will be pointed to

        bool MyFn1( void );
        bool MyFn2( void );
        bool MyFn3( void );

        // Function that will call others via pointers

        void Run();
};

// Macro to help declare data 

// (in case the FnCallEtAl struct changes)

#define TABITEM( ID, FN ) { ID, FN },


// My.cpp

#inlcude "My.h"

// Instantiate static data members

CMyClass::FnCallEtAl CMyClass::MyMemberFns[NUM_FNS] = 
{
      TABITEM( 1, MyFn1 )
      TABITEM( 2, MyFn2 )
      TABITEM( 0, MyFn3 )  
}; 

CMyClass::Run()
{
      int nId;
      while( SomeBaseClassFn( &nId ) )
      {
         // Here is the really tricky code

         // Tricky because you have to use the this pointer

         //    to make the function call.   

         if( !(this->*(MyMemberFns[nId].pFn))()  ) 
	    return;
      }
}

bool CMyClass::MyFn1()
{
      return true;
}

  
So what is the most bizar code or the tricky syntax you have ever written?
Hmmm... your code is pretty tricky !!!

Here's somehting that caused MUCH headache:

    // Loop trough all face edges of the current face		for (iCurFaceEdge=0; iCurFaceEdge<m_pFaces[iCurFace].iNumEdges; iCurFaceEdge++)		{			// Don't read behind the face edge array			assert(m_pFaces[iCurFace].lFirstEdge + iCurFaceEdge < 				m_sCount.iFaceEdgeCount);			// Don't read behind the edge array. Drop a possible negative sign			// because this is only used to indicate the 'winding' of the edge			assert((unsigned long) abs(m_pFaceEdges[m_pFaces[iCurFace].lFirstEdge +				iCurFaceEdge]) < m_sCount.iEdgeCount);								// Look up the two edge vertex indexes in the edge array			iVertex1 = m_pEdges[abs(m_pFaceEdges[m_pFaces[iCurFace].lFirstEdge +				iCurFaceEdge])].iVertex1;			iVertex2 = m_pEdges[abs(m_pFaceEdges[m_pFaces[iCurFace].lFirstEdge + 				iCurFaceEdge])].iVertex2;					// Reverse the vertex order			if (m_pFaceEdges[m_pFaces[iCurFace].lFirstEdge + iCurFaceEdge] > 0)			{				iTempVertex = iVertex1;				iVertex1 = iVertex2;				iVertex2 = iTempVertex;			}			// Texture coordinate for the first vertex			fU = (m_pVertices[iVertex1].x * pTexInfo->UAxis.x + m_pVertices[iVertex1].y *				pTexInfo->UAxis.y + m_pVertices[iVertex1].z * 				pTexInfo->UAxis.z + pTexInfo->UOffset) / iTexWidth;			fV = (m_pVertices[iVertex1].x * pTexInfo->VAxis.x + m_pVertices[iVertex1].y *				pTexInfo->VAxis.y + m_pVertices[iVertex1].z * 				pTexInfo->VAxis.z + pTexInfo->VOffset) / iTexWidth;			// Pass the coordinates for world and lightmap texture			cMultitexturing.MultiTexCoord2f(GL_TEXTURE0_ARB, fU, fV);			cMultitexturing.MultiTexCoord2f(GL_TEXTURE1_ARB, 				(float) 1.0f - ( (m_pLightmaps[iCurFace].cLightmap.GetTexWidth() / 2.0f) +				(fU - m_pLightmaps[iCurFace].fMidFaceU) / 16.0f),				(float) 1.0f - ((m_pLightmaps[iCurFace].cLightmap.GetTexHeight() / 2.0f) +				(fV - m_pLightmaps[iCurFace].fMidFaceV) / 16.0f));						// Pass the first vertex			glVertex3f(m_pVertices[iVertex1].x, m_pVertices[iVertex1].y, 				m_pVertices[iVertex1].z);			// Texture coordinate for the second vertex			fU = (m_pVertices[iVertex2].x * pTexInfo->UAxis.x + m_pVertices[iVertex2].y *				pTexInfo->UAxis.y + m_pVertices[iVertex2].z * 				pTexInfo->UAxis.z + pTexInfo->UOffset) / iTexWidth;			fV = (m_pVertices[iVertex2].x * pTexInfo->VAxis.x + m_pVertices[iVertex2].y *				pTexInfo->VAxis.y + m_pVertices[iVertex2].z * 				pTexInfo->VAxis.z + pTexInfo->VOffset) / iTexWidth;			// Pass the texture coordinates for world and lightmap texture			cMultitexturing.MultiTexCoord2f(GL_TEXTURE0_ARB, fU, fV);			cMultitexturing.MultiTexCoord2f(GL_TEXTURE1_ARB, 				(float) 1.0f -((m_pLightmaps[iCurFace].cLightmap.GetTexWidth() / 2.0f) +				(fU - m_pLightmaps[iCurFace].fMidFaceU) / 16.0f),				(float) 1.0f -((m_pLightmaps[iCurFace].cLightmap.GetTexHeight() / 2.0f) +				(fV - m_pLightmaps[iCurFace].fMidFaceV) / 16.0f));			// Pass the second vertex			glVertex3f(m_pVertices[iVertex2].x, m_pVertices[iVertex2].y, 				m_pVertices[iVertex2].z);		}  [/source]Optimizing this stuff was also somehow tricky ;-)[source]////////////////////////////////////////////////////////////////////////	// Calculate the landscape texure array	////////////////////////////////////////////////////////////////////////	// Progress window to keep user updated about the time consuming	// process of generating the landscape texture	CProgressWindow::SetTask("Generating Landscape Texture...");	// Allocate memory for the landscape texture	pTextureData = new unsigned char [iTexSize * iTexSize * 3];	float fLastHeight = 0.0f;	// Fill the texture with a combination of all landscape textures. Make a height based	// per-texel choice of the source texture	for (i=0; i<iTexSize; i++)	{		// Update the progress window		CProgressWindow::SetProgress((unsigned int) ((i * iTexSize) / 			(float) (iTexSize * iTexSize) * 100.0f));		for (j=0; j<iTexSize; j++)		{			// Modify the heightmap with a random value to make the texture			// transistion more natural			pHeight->m_Array<i>[j] += ((float) rand() /				(float) RAND_MAX * fRandMod - (fRandMod / 2.0f));			// Correct invalid values caused by the random value			if (pHeight->m_Array[i][j] > 255)				pHeight->m_Array[i][j] = 255;			if (pHeight->m_Array[i][j] < 0)				pHeight->m_Array[i][j] = 0;			// Calculate the "average" texture index. Also precalculate floor and			// ceiling values. Use fast asm integer floor and fast asm 			// float / integer conversion			fTexIndex = pHeight->m_Array[i][j] / 255.0f * iMaxTexture;			iTexIndexCe = RoundFloatToInt((float) ceil(fTexIndex));			iTexIndexFl = asmifloor(fTexIndex);						// Calculate the weights of each texture			fHighTexWeight = fTexIndex - iTexIndexFl;			fLowTexWeight = iTexIndexCe - fTexIndex;			// Neccessary to avoid black textures when we directly hit a			// texture index			if (fHighTexWeight == 0.0f && fLowTexWeight == 0.0f)			{				fHighTexWeight = 0.5f;				fLowTexWeight = 0.5f;			}			// Don't allow that we exceed the maximum texture count			if (iTexIndexCe > iMaxTexture - 1)				iTexIndexCe = iMaxTexture - 1;			if (iTexIndexFl > iMaxTexture - 1)				iTexIndexFl = iMaxTexture - 1;						// Calculate the texel offset in the lower texture array			iIndex = ((j % cTGATextures[iTexIndexFl].GetImageWidth()) * 				cTGATextures[iTexIndexFl].GetImageWidth() +				(i % cTGATextures[iTexIndexFl].GetImageHeight())) * 3;						// Add the lower texture			cTexel[0] = FloatToByte				((cTGATextures[iTexIndexFl].GetImageData()[iIndex + 0] * fLowTexWeight));			cTexel[1] = FloatToByte				((cTGATextures[iTexIndexFl].GetImageData()[iIndex + 1] * fLowTexWeight));			cTexel[2] = FloatToByte				((cTGATextures[iTexIndexFl].GetImageData()[iIndex + 2] * fLowTexWeight));			// Calculate the texel offset in the higher texture array			iIndex = ((j % cTGATextures[iTexIndexCe].GetImageWidth()) * 				cTGATextures[iTexIndexCe].GetImageWidth() +				(i % cTGATextures[iTexIndexCe].GetImageHeight())) * 3;			// Add the higher texture			cTexel[0] += FloatToByte				((cTGATextures[iTexIndexCe].GetImageData()[iIndex + 0]) * fHighTexWeight);			cTexel[1] += FloatToByte				((cTGATextures[iTexIndexCe].GetImageData()[iIndex + 1]) * fHighTexWeight);			cTexel[2] += FloatToByte				((cTGATextures[iTexIndexCe].GetImageData()[iIndex + 2]) * fHighTexWeight);			// Copy the texel to its destination			memcpy(&pTextureData[(j * iTexSize + i) * 3], cTexel, 3);			fLastHeight = pHeight->m_Array[i][j];		}	}  [/source]  Finally, this code from nVidia looks plain cool<pre>FP_BITS(n) = iFastSqrtTable[(FP_BITS(n) >> 8) & 0xFFFF] | 		((((FP_BITS(n) - 0x3F800000) >> 1) +		0x3F800000) & 0x7F800000);    


Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity

Edited by - tcs on December 5, 2000 4:57:16 PM
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
Advertisement
  #!/usr/bin/perl@a=(Lbzjoftt,Inqbujfodf,Hvcsjt); $b="Lbssz Wbmm";$b =~ y/b-z/a-z/ ; $c =" Tif ". @a ." hsfbu wj"."suvft pg b qsphsbnnfs". ":\n";$c =~y/b-y/a-z/;print"\n\n$c ";for($i=0;$i<@a; $i++) { $a[$i] =~y/b-y/a-z/;if($a[$i]eq$a[-1]){print"and $a[$i].";}else{ print"$a[$i], ";}}print"\n\t\t--$b\n\n";   


Perl is cool

I didn''t write that btw
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
This are the kewlest things i''ve ever seen ( not mine )

#include

main(t,_,a)
char *a;
{return!0main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
)&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,
t,"@n''+,#''/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\
,/+#n+,/#;#q#n+,/+k#;*+,/''r :''d*''3,}{w+K w''K:''+}e#'';dq#''l q#''+d''K#!/\
+k#;q#''r}eKK#}w''r}eKK{nl]''/#;#q#n''){)#}w''){){nl]''/+#n'';d}rw'' i;# ){n\
l]!/n{n#''; r{#w''r nc{nl]''/#{l,+''K {rw'' iK{;[{nl]''/w#q#\
n''wk nw'' iwk{KK{nl]!/w{%''l##w#'' i; :{nl]''/*{q#''ld;r''}{nlwb!/*de}''c \
;;{nl''-{}rw]''/+,}##''*}#nc,'',#nw]''/+kd''+e}+;\
#''rdq#w! nr''/ '') }+}{rl#''{n'' '')# }''+}##(!!/")
:t<-50?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == ''/'')+t,_,a\
+1 ):0i@bK''(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}


or


#include
#include
#define a typedef
a long N;
#define i =m(p(r,o,v),e,d
N G,l,I,C,B,A,W,L,S
, R,O,c,k,s =
80, U=13
,T=169; a double P;
#define F for(
a P*E; a char*w; P sqrt(P); N H(){ F;
O=scanf(" %[#]%*[^\n]",&O); ); scanf("%ld%*c",&O);
#define D return
D O; }



#define V =malloc(sizeof(
#define M M(
#define X +=
P M N R){ s= s>=k?printf( "%ld%c"
+3*(C<1),s-k, R&7?32:10):s; D R>0?B
/2?H():getchar ():R?.9+.7*M R+1):0; }
P t(N x,P K){ D x?(x>U?0:t(x+2,K)*(x-1)
/x/K)+1/sqrt(K): t(2,K*K/U+1)*K; } N _(N
J,N x){ F*(x?&W:& A)=W+J+x; (O=x=W/(J=k*k))
||AJ*=x+O; S--*B&&x==O ; O=x=!J){ s X x+s; M 0); }
W X W-J; S X 2; L X L-J*k+M S%8==B); } D 1; } E
p(E J,E x,E O){ F R=T; R--; )O[R]=J[R]+.8*x[R]; D O;
} P m(E W,E x,P s){ F R = U; --R; ){ E A=W+R*U; W[R]X s/
12; *W X s; *A-=*x++; F; A>W; ){ *A/=*W; F O=R; O; O--)A[O]-=
W[O]**A; A-=U; } W X 14; } D*W; } int main(int z,w*y){ N K=s,g; Y;
M z); s= B=C=15-H(); s=G= M 8); s=l=M C); G*=g=C%3?1:3; if(I=s=M 8)){ N
b=G+9,x=b*340+U,J=b*(l+5), * n V N ) * J ),*j=n+5*b; E h V P)*x),q=h+b,e=q+
b; P d=K; F; J--; )n[J]=J=4-C; B=C/4; s=_(_(T,0),0); F ; -- z ; ){ R=atoi(*++y); c=R>0?K=R,c :-2*R;
} z=G/K+1; z X g>z; I++; c++; F ; ++ J=o-2*T,v=r-T; F; x [x] );
} p(H,
H,r );
F; x;
) { E S=
e ; w l =
" !{ ,;lf6D@"
; j X 1-g; F; *++l;
){ *S++ =*j; j X*l%3*g-
g+*l%5*b-3*b; } y =M x-G);
y =M-J)* M-x)+ M-J-1)*y+.01; y=
sqrt((u+q[--x]+.1)/y ); o-=T; C i)+
#define Z(x)(t(0,(x-C)/y)-l+1e-6*(x-Q))
.5; K=M-B); { N f=I,Q=0; F; f-Q>c; ){ P l=0
; N H = C+c/2+1; H%=c; H X(f+Q+c-2*H)/2/c*c; l=
Z(Q); O=(A-W)*Z(H)/Z(f); _(O,R=B?K>= H:L/k>O+W); *(
R?&Q:&f)=H; } Q X f; *S=*j=Q/=2; s=B?s:Q+k; f=Q+n[x/z];
n[x/z]=x%z+J%(z*2/g)?f:!putc(x?l[4*g*f/z/z/I-8]:10,stderr);
H-=U; F O=156; O--; ){ H--; *H=e[O%U]*e[O/U]/y+.8**H; } C-=Q+.5
; y i/.9)-Q-C; p(p(r+T,r,r),H,r); h[x]=.7*h[x]+C*C; u X h[x]; u*=.7
; d X C>0?-y:y; } } j X 9; } _(_(x,x),x); } D 0; }




and the there is




#define/**/X
char*d="X0[!4cM,!"
"4cK`*!4cJc(!4cHg&!4c$j"
"8f''!&~]9e)!''|:d+!)rAc-!*m*"
":d/!4c(b4e0!1r2e2!/t0e4!-y-c6!"
"+|,c6!)f$b(h*c6!(d''b(i)d5!(b*a''`&c"
")c5!''b+`&b''c)c4!&b-_$c''d*c3!&a.h''d+"
"d1!%a/g''e+e0!%b-g(d.d/!&c*h''d1d-!(d%g)"
"d4d+!*l,d7d)!,h-d;c''!.b0c>d%!A`Dc$![7)35E"
"!''1cA,,!2kE`*!-s@d(!(k(f//g&!)f.e5''f(!+a+)"
"f%2g*!?f5f,!=f-*e/! "+e6!0f%k)d7!+~^''c7!)z/d-+!''n%a0(d5!%c1a+/d4"
"!2)c9e2!9b;e1!8b>e/! 7cAd-!5fAe+!7fBe(!"
"8hBd&!:iAd$![7S,Q0!1 bF 7!1b?''_6!1c,8b4"
"!2b*a,*d3!2n4f2!${4 f. ''!%y4e5!&f%"
"d-^-d7!4c+b)d9!4c-a ''d :!/i(''`&d"
";!+l''a+d!&d''"
"`0_&c?!$dAc@!$cBc@!$ b < ^&d$`"
":!$d9_&l++^$!%f3a'' n1 _ $ !&"
"f/c(o/_%!(f+c)q*c %! * f &d+"
"f$s&!-n,d)n(!0i- c- k) ! 3d"
"/b0h*!H`7a,![7* i] 5 4 71"
"[=ohr&o*t*q*`*d *v *r ; 02"
"7*~=h./}tcrsth &t : r 9b"
"].,b-725-.t--// #r [ < t8-"
"752793? <.~;b ].t--+r / # 53"
"7-r[/9~X .v90 <6/<.v;-52/={ k goh"
"./}q; u vto hr `.i*$engt$ $ ,b"
";$/ =t ;v; 6 =`it.`;7=` : ,b-"
"725 = / o`. .d ;b]`--[/+ 55/ }o"
"`.d : - ?5 / }o`.'' v/i]q - "
"-[; 5 2 =` it . o;53- . "
"v96 <7 / =o : d =o"
"--/i ]q-- [; h. / = "
"i]q--[ ;v 9h ./ < - "
"52={cj u c&` i t . o ; "
"?4=o:d= o-- / i ]q - "
"-[;54={ cj uc& i]q - -"
"[;76=i]q[;6 =vsr u.i / ={"
"=),BihY_gha ,)\0 " , o [
3217];int i, r,w,f , b ,x ,
p;n(){return r 768?d[X(143+ X r++ + *d ) %
768]:r>2659 ? 59: ( x = d
[(r++-768)% X 947 + 768] ) ?
x^(p?6:0)p = 34 X X X )
;}s(){for(x= n (); ( x^ ( p
?6:0))==32;x= n () ) ;return x ; }
void/**/main X () { r = p
=0;w=sprintf (X X X X X X o
,"char*d="); for ( f=1;f < * d
+143if(33-( b=d [ f++ X ] )
){if(b<93){if X(! p ) o
[w++]=34;for X(i = 35 +
(p?0:1);i [w++]=s();o[ w++ ]
=p?s():34;} else X
{for(i=92; i ++)o[w++]= 32;} }
else o [w++ ]
=10;o [
w]=0 ;
puts(o);}






# include
# include
# include
# define W(f) f##Window(S,
# define O ; break ; case
# define _ * s

XID w,r,l=45<<9, d,v =1,E; GC V[2]; typedef
char * K; Display *S; XGCValues g; typedef int Y; K j;
double *o,I [99] ,T= 0,t ,_, atof( ); K X(K
i){ for (r=0 ; o=s-1 ,*i ; i ++ ) { switch (*i){
struct { K Y; Y K, t ; XID k ; } Z; K z= j++;
O 32L :*o *=_ --O ''}'' :*o /=_ --O 73:
*o += _ --O 61 :*o -=_ --O 123
:_= sin (_) O 94 :_= asin (_) O 47
:_= cos (_) O 45 : _= fmod(_ ,2* M_PI
)O 076 :_= sqrt (_) O 33: t=*o; *o=
_; _=t O 48 :_= cos (_) <0 O 86
:j= i O 43: X(z ="K I@I-" )O 93:
X(z ="/ =")O 60 : i =++ r - 4 ? j-1 :i O 79
:XDrawArc(S, d,V [(Y )_] ,(Y ) ( 399 +14 _ [
-2] ),( Y)( *"'' "+14 _ [ -1]) ,2,2 ,0,l
) ; { Z. Y = i - 127 +r/ 3*2 ; Z.K= r%3+
r/3 +1; Z.t =0; Z.k=E ; XDrawText (S,d,*V,(Y
) ( 399 +14 *1[s-= strlen(z) ]),20,

&Z,1); } O 1:default:*i>90?I[*i-32]=_--*++s
=I[*i+(*i<73)*r]); } } } Y main
(Y G,K*A){ *A=

" 8<$ $li >d# -d8Z''Et#)wWP]WM C\\TI)#%!DcUAvz% H2&08M\\%YaHAW}4+%g ;|XN%W|l!_Kz+$UgBix41r=H7b@_:X 4zS EFo1i}= _D.%biA xF>)k*T(7&m \"G~ )TY *.^@$0.#yl< 66,/dI ;\\[![:- $u6 VnD X+ )TY-L38 :%\" )TY%8Z$ \"G|BfCb m@{;M} ^`K !T PIIIV[;I{ k;I/@{ K!=k;!={LM=M} K!=jM!}T!=k@P=`+e+f+g+hK I-[K I-pEF=Q `FG=Q k@]aK]b;]cP]d@{ EIeK{ FIf;{ GIgP{ HIhVAE{ J{AE/ E0\117<";

w = DefaultScreen ( S =
XOpenDisplay(0)); W( XMap
)d =W(XCreateSimple ) W(
Root )w),0,0,800,80 ,0,0
,BlackPixel(S,w ))) ; g.
foreground=WhitePixel (S,w
); *(Y *) &g=6; for (; v
[V ]=XCreateGC( S,d ,4 +
v, &g),!--v; ); for ( E=
XLoadFont(S,"10x20" ),81
=2; I[84]=( G>2?
atof(2 3028 +3[j])/t)*pow(6e-4+
1,j[ sizeof* X(++j) ]+95
**j- 3072.)-1; )j+=4; s-=
2; W (XClear)d); XFillArc
(S,d ,*V,385,25,0x1c,28,
0,l) ; X( j+4); XSync(S,
0) ; usleep(10000);




All this really works!!!
look at www.ioccc.org
there''s a lot of this stuff
' Target=_Blank>Link
I''ve been in situtations where I have written code to write code, mainly initizing large arrays.

I don''t know if this come under bizar syntax but I think its a bit strange.
One time I made a 3D game that did the graphics routine in Visual Basic (with GDI), the menu bar in Assembly, and the Help file in COBOL. JK!
Advertisement
The code I write is not normally meant to be seen by other human eyes, so I favour conciseness over clarity. I know I can understand my own code, so I don''t add extra stuff in. In a library I was writing, I put in a default message handling function. But since the user should be able to extend that handler, I allowed them to set a function variable. The default value, NULL, meant that the user hadn''t set such a function. So how can I, in the least lines possible, check if the user window procedure has been set, if so, calling it, and if not, calling DefWindowProc, and then returning the correct value? I came up with this:

return (UserWndProc?UserWndProc:DefWindowProc)(hWnd, msg, wParam, lParam);
Ok, in my rts, to get the speed of the unit on square (X, Y)

Speed = modReference.ReferenceUnits(Map.Unit(Map.Map(X, Y).UnitIndex).UnitID).Speed

Not actually too screwy to understand, but just gets pretty complex with so many different arrays and stuff... VB doesn''t really lend itself to cool syntaxes like those ones messing with pointers... well, actually, if you put your mind to it, you can come up with some unreadable stuff (like if you decide that you are going to go and use line numbers, "Goto"s and "Let"s.

Oh, and opening files, I like to shove in as many keywords as possible:

Open Filename For Binary Access Read Write Lock Read Write As Filenum

when to do the same thing I could use:

Open Filename For Binary As Filenum

... makes me look smarter
Trying is the first step towards failure.
A nice if condition
    if (mode1 == VOIDmode     || GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG     || (modifier != EXPAND_CONST_ADDRESS         && modifier != EXPAND_INITIALIZER         && ((mode1 != BLKmode && ! direct_load[(int) mode1]              && GET_MODE_CLASS (mode) != MODE_COMPLEX_INT              && GET_MODE_CLASS (mode) != MODE_COMPLEX_FLOAT)             // If the field isn't aligned enough to fetch as a memref,             // fetch it as a bit field.               || (mode1 != BLKmode                  && SLOW_UNALIGNED_ACCESS (mode1, alignment)                 && ((TYPE_ALIGN (TREE_TYPE (tem))                      < GET_MODE_ALIGNMENT (mode))                     || (bitpos % GET_MODE_ALIGNMENT (mode) != 0)))             // If the type and the field are a constant size and the             // size of the type isn't the same size as the bitfield,             // we must use bitfield operations.               || ((bitsize >= 0                  && (TREE_CODE (TYPE_SIZE (TREE_TYPE (exp)))                      == INTEGER_CST)                  && 0 != compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)),                                            bitsize)))))     || (modifier != EXPAND_CONST_ADDRESS         && modifier != EXPAND_INITIALIZER         && mode == BLKmode         && SLOW_UNALIGNED_ACCESS (mode, alignment)         && (TYPE_ALIGN (type) > alignment             || bitpos % TYPE_ALIGN (type) != 0)))   {    

from somewhere in the GCC sources. I didn't write it though.

Edited by - Dactylos on July 25, 2001 7:58:30 AM
I posted some code a while ago which extracted the path and application name from the argument list of a win32 app in a rather unorthodox manner...

    int APIENTRY WinMain(HINSTANCE hInstance,                     HINSTANCE hPrevInstance,                     LPSTR     lpCmdLine,                     int       nCmdShow){  char* commandLine;  for(int i = 2;(lpCmdLine-i)[0] != '"';i++);  commandLine = lpCmdLine-i;  ...  ...}    


Edited by - Sandman on July 25, 2001 8:21:40 AM

This topic is closed to new replies.

Advertisement