Re: How to work around this compiler bug

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: patrick keshishian
Date: Sunday, May 2, 2010 - 12:54 pm

On Sun, May 2, 2010 at 3:59 AM, Christopher Zimmermann
<madroach@zakweb.de> wrote:
macro, because I need __LINE__, __FILE__, __CLASS__...


You example obviously isn't showing the exact usage you require. I
imagine the macro is being used in assignments, not just in the blub()
method as you display.


Cheers,
--patrick

$ cat fuck.c++
#include <stdlib.h>
#include <err.h>

#include <iostream>

#define WarnIfNULL(x)	((!(x) && ((void)warnx("blub"),1)) ? (x) : (x))


class A {
protected:
	int	a;
};

class B : public A {
public:
	void	blub(void) { WarnIfNULL(A::a); }
};

int
main(int argc, char *argv[])
{
	int	bs = 10;
	B	cxxsucks;

	cxxsucks.blub();

	bs = WarnIfNULL(100);
	::std::cout << "bullshit: " << bs << ::std::endl;

	exit(0);
}
$ c++ fuck.c++
/usr/lib/libstdc++.so.49.0: warning: strcpy() is almost always
misused, please use strlcpy()
/usr/lib/libstdc++.so.49.0: warning: strcat() is almost always
misused, please use strlcat()
$ ./a.out
a.out: blub
bullshit: 100
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
How to work around this compiler bug, Christopher Zimmermann, (Sat May 1, 2:39 am)
Re: How to work around this compiler bug, Landry Breuil, (Sat May 1, 3:07 am)
Re: How to work around this compiler bug, Marc Espie, (Sat May 1, 5:11 am)
Re: How to work around this compiler bug, Michael Small, (Sat May 1, 5:46 am)
Re: How to work around this compiler bug, Marco Peereboom, (Sat May 1, 8:12 am)
Re: How to work around this compiler bug, Christopher Zimmermann, (Sun May 2, 3:59 am)
Re: How to work around this compiler bug, patrick keshishian, (Sun May 2, 12:54 pm)
Re: How to work around this compiler bug, Marc Espie, (Sun May 2, 1:00 pm)
Re: [SOLVED] How to work around this compiler bug, Christopher Zimmermann, (Sun May 2, 1:21 pm)
Re: How to work around this compiler bug, Christopher Zimmermann, (Thu May 20, 6:18 am)
Re: How to work around this compiler bug, Landry Breuil, (Thu May 20, 6:52 am)
Re: How to work around this compiler bug, Christopher Zimmermann, (Thu May 20, 7:01 am)
Re: [SOLVED] How to work around this compiler bug, Christopher Zimmermann, (Thu May 20, 7:45 am)
Re: [SOLVED] How to work around this compiler bug, David Coppa, (Thu May 20, 12:04 pm)