Rule 3-2-3 and friend Declarations

Moderators: david ward, misra cpp

Post Reply
gs
Posts: 87
Joined: Thu Nov 18, 2004 1:39 am

Rule 3-2-3 and friend Declarations

Post by gs » Thu Sep 30, 2010 5:28 pm

Am I correct in presuming rule 3-2-3 does not apply to friend declarations? For example, if I declare a class type in a header file, am I permitted to declare that class as a friend of another type in a different file?

misra cpp
Posts: 145
Joined: Mon Jun 02, 2008 1:55 pm
Company: MISRA

Re: Rule 3-2-3 and friend Declarations

Post by misra cpp » Tue Oct 11, 2016 10:33 am

This rule does not preclude the use of friend or forward reference statements, but these must be in a separate header file.

A future edition may reconsider this point
Posted by and on behalf of
the MISRA C++ Working Group

Post Reply

Return to “6.3 Basic concepts (C++)”