G++ switch to make everything public in a class?

Magnus Müller mamuelle@informatik.hu-berlin.de
Sun Jul 31 18:58:00 GMT 2011


On Sun, 31 Jul 2011 14:35:48 -0400
Jeffrey Walton <noloader@gmail.com> wrote:

>>Hi All,
>>
>>I'm interested in writing test cases against c++ classes. For testing,
>>I'd like everything to be public so I can call protected and private
>>functions with bad data for negative test cases.
>>
>>I don't want to use friendship since its for testing only (it would
>>pollute the interfaces).
>>
>>Is there a switch to force everything public? If not, how does one
>>typically access the non-public stuff for testing?
>>
>>Jeff

Define private to be public:

	gcc -Dprivate="public"

That could produce compile time errors, but it does no harm to try it.


Magnus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20110731/8cd77f43/attachment-0001.sig>


More information about the Gcc-help mailing list