discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml [CVS_2015_11_07] C++ Declaration Guards
@ 2015-11-07  3:29 Peter Bray
  2015-11-07  3:37 ` Guy Harris
  2015-11-07 14:06 ` Ingo Schwarze
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Bray @ 2015-11-07  3:29 UTC (permalink / raw)
  To: discuss

Greetings,

Many of the header files in the mdocml project use the cpp(1) macros
'__BEGIN_DECLS' && '__END_DECLS', which IMHO is "A Good Thing(TM)".

But neither Solaris 10 or 11.2 define these macros in any standard
header files, so the project has to provide them.

Currently, this is done by generating the appropriate code into 'config.h'.

This is not sufficient to allow the code to compile on Solaris 10.

To progress the build, the files 'mandoc.h' and 'mandoc_aux.h' can be
edited to include the line '#include "config.h"'. And the build will
proceed.

Unfortunately, this is not a desirable solution, as these header files
get installed via 'make install'. So the correct solution will
probably involve having these definitions moved from 'config.h' to an
installed header file. If users of the library will always load a
common header file, than the declaration could go there. But the
project's own code, requires that at least two files be edited to
allow the build to proceed (as mentioned above).

Alternatively, maybe a generated header, say mandoc_compat.h could be
generated by the configure scripts and all the (installed) header
files using '__BEGIN_DECLS' && '__END_DECLS', could
'#include"mandoc_compat.h", as an example.

I'll leave it to the developers and maintainers to choose the
appropriate solution for their code base.

Regards,

Peter Bray
Sydney, Australia
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mdocml [CVS_2015_11_07] C++ Declaration Guards
  2015-11-07  3:29 mdocml [CVS_2015_11_07] C++ Declaration Guards Peter Bray
@ 2015-11-07  3:37 ` Guy Harris
  2015-11-07 14:06 ` Ingo Schwarze
  1 sibling, 0 replies; 7+ messages in thread
From: Guy Harris @ 2015-11-07  3:37 UTC (permalink / raw)
  To: discuss


On Nov 6, 2015, at 7:29 PM, Peter Bray <pdb_ml@yahoo.com.au> wrote:

> I'll leave it to the developers and maintainers to choose the
> appropriate solution for their code base.

Replace __BEGIN_DECLS with

	#ifdef __cplusplus
	extern "C" {
	#endif

and replace __END_DECLS with

	#ifdef __cplusplus
	}
	#endif

?  Perhaps a bit uglier, but more easily portable, and it makes it a bit more obvious what's actually being done.

(That's the solution used by two code bases I work on - libpcap and Wireshark.)--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mdocml [CVS_2015_11_07] C++ Declaration Guards
  2015-11-07  3:29 mdocml [CVS_2015_11_07] C++ Declaration Guards Peter Bray
  2015-11-07  3:37 ` Guy Harris
@ 2015-11-07 14:06 ` Ingo Schwarze
  2015-11-07 14:25   ` Joerg Sonnenberger
  1 sibling, 1 reply; 7+ messages in thread
From: Ingo Schwarze @ 2015-11-07 14:06 UTC (permalink / raw)
  To: Peter Bray; +Cc: discuss

Hi Peter,

Peter Bray wrote on Sat, Nov 07, 2015 at 02:29:19PM +1100:

> I'll leave it to the developers and maintainers to choose the
> appropriate solution for their code base.

I just deleted them: KISS.

They have never been used for anything in more than six years
and are apparently becoming a portability headache.

Besides, i want to strongly discourage any use of C++ in
software documentation.  Getting away from C++ is one of the
chief design goals of the mandoc project.

Yours,
  Ingo
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mdocml [CVS_2015_11_07] C++ Declaration Guards
  2015-11-07 14:06 ` Ingo Schwarze
@ 2015-11-07 14:25   ` Joerg Sonnenberger
  2015-11-07 14:34     ` Ingo Schwarze
  2015-11-11 10:57     ` Steffen Nurpmeso
  0 siblings, 2 replies; 7+ messages in thread
From: Joerg Sonnenberger @ 2015-11-07 14:25 UTC (permalink / raw)
  To: discuss; +Cc: Peter Bray

On Sat, Nov 07, 2015 at 03:06:30PM +0100, Ingo Schwarze wrote:
> Besides, i want to strongly discourage any use of C++ in
> software documentation.  Getting away from C++ is one of the
> chief design goals of the mandoc project.

Seriously, please don't call groff C++. It is not. It is C with classes.
It doesn't even use the most fundamental data types like vectors.

Joerg
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mdocml [CVS_2015_11_07] C++ Declaration Guards
  2015-11-07 14:25   ` Joerg Sonnenberger
@ 2015-11-07 14:34     ` Ingo Schwarze
  2015-11-07 14:37       ` Joerg Sonnenberger
  2015-11-11 10:57     ` Steffen Nurpmeso
  1 sibling, 1 reply; 7+ messages in thread
From: Ingo Schwarze @ 2015-11-07 14:34 UTC (permalink / raw)
  To: Joerg Sonnenberger; +Cc: discuss

Hi Joerg,

Joerg Sonnenberger wrote on Sat, Nov 07, 2015 at 03:25:23PM +0100:
> On Sat, Nov 07, 2015 at 03:06:30PM +0100, Ingo Schwarze wrote:

>> Besides, i want to strongly discourage any use of C++ in
>> software documentation.  Getting away from C++ is one of the
>> chief design goals of the mandoc project.

> Seriously, please don't call groff C++. It is not. It is C with classes.
> It doesn't even use the most fundamental data types like vectors.

You have a point.

Fortunately, INSTALL doen't talk about groff at all,
it only talks about mandoc design goals:

  One of the chief design goals of the mandoc toolbox is to make
  sure that nothing related to documentation requires C++.
  Consequently, linking mandoc against any kind of C++ program
  would defeat the purpose and is not supported.

So, i don't think i need to change anything there.

Yours,
  Ingo
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mdocml [CVS_2015_11_07] C++ Declaration Guards
  2015-11-07 14:34     ` Ingo Schwarze
@ 2015-11-07 14:37       ` Joerg Sonnenberger
  0 siblings, 0 replies; 7+ messages in thread
From: Joerg Sonnenberger @ 2015-11-07 14:37 UTC (permalink / raw)
  To: discuss

On Sat, Nov 07, 2015 at 03:34:49PM +0100, Ingo Schwarze wrote:
> Hi Joerg,
> 
> Joerg Sonnenberger wrote on Sat, Nov 07, 2015 at 03:25:23PM +0100:
> > On Sat, Nov 07, 2015 at 03:06:30PM +0100, Ingo Schwarze wrote:
> 
> >> Besides, i want to strongly discourage any use of C++ in
> >> software documentation.  Getting away from C++ is one of the
> >> chief design goals of the mandoc project.
> 
> > Seriously, please don't call groff C++. It is not. It is C with classes.
> > It doesn't even use the most fundamental data types like vectors.
> 
> You have a point.
> 
> Fortunately, INSTALL doen't talk about groff at all,
> it only talks about mandoc design goals:
> 
>   One of the chief design goals of the mandoc toolbox is to make
>   sure that nothing related to documentation requires C++.
>   Consequently, linking mandoc against any kind of C++ program
>   would defeat the purpose and is not supported.
> 
> So, i don't think i need to change anything there.

Keep in mind that the purpose of the guards was the *inverse*. They make
it simpler to *use* mandoc from C++ programs.

Joerg
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: mdocml [CVS_2015_11_07] C++ Declaration Guards
  2015-11-07 14:25   ` Joerg Sonnenberger
  2015-11-07 14:34     ` Ingo Schwarze
@ 2015-11-11 10:57     ` Steffen Nurpmeso
  1 sibling, 0 replies; 7+ messages in thread
From: Steffen Nurpmeso @ 2015-11-11 10:57 UTC (permalink / raw)
  To: discuss; +Cc: Peter Bray

Joerg Sonnenberger <joerg@britannica.bec.de> wrote:
 |On Sat, Nov 07, 2015 at 03:06:30PM +0100, Ingo Schwarze wrote:
 |> Besides, i want to strongly discourage any use of C++ in

 |Seriously, please don't call groff C++. It is not. It is C with classes.
 |It doesn't even use the most fundamental data types like vectors.

Luckily that is!  The C++ standard types are plain shit for most
use cases i can think about due to the completely useless
copy-creation + original-object-destruction that takes place upon
resizes etc.  Yes you can use <T *> instead -- and then loose ptr
management.  Maybe some kind of auto_ptr<> exists in the meantime.
Uff.  And the terrible bloat.  Granted that things may have
changed since "The C++ Programming Language, Third Edition".  But
i hope the compilers of the future will continue to support
"-fno-rtti -fno-exceptions" plus.

--steffen
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-11 10:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07  3:29 mdocml [CVS_2015_11_07] C++ Declaration Guards Peter Bray
2015-11-07  3:37 ` Guy Harris
2015-11-07 14:06 ` Ingo Schwarze
2015-11-07 14:25   ` Joerg Sonnenberger
2015-11-07 14:34     ` Ingo Schwarze
2015-11-07 14:37       ` Joerg Sonnenberger
2015-11-11 10:57     ` Steffen Nurpmeso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).