* Martin Sustrik <[email protected]> [2011-11-14 08:55:08 +0100]:

> However, two issues:
> 
> 1. Moving the header to another location would break the backward 
> compatibility.

There is full backward compatibility at the source code level. The only change
required is to specify a new inclusion path to the compiler.  For people using
pkg-config, there is no change at all as the new cflag flag is reflected in my 
patch.  The change is also trivial for anyone using any build system at all.

Examples
--------

1) manual build:

g++ -lzmq -o app app.c (becomes)
g++ -I/usr/include/zmq -lzmq -o app app.c

2) make build: requires a minor edit to Makefile, usual of the form:

CC=g++
CXXFLAGS=-I/usr/include/zmq (<-just add this include path)

.cc.o:
    $(CC) $(CXXFLAGS) $< -o $@

3) pkg-config build:

g++ `pkg-config --cflags --libs libzmq` -o app app.c (no change)

4) autotools build:

The change is trivial, or no change, if people are integrating
pkg-config with autotools, e.g.

---configure.ac/.in)-----
PKG_CHECK_MODULES(ZMQ, libzmq)

---Makefile.am-----
program_CXXFLAGS = $(ZMQ_CXXFLAGS) ...

In summary, there is no need to revisit the source code to make any changes.

> 2. What's the rationale for moving the header? I prefer writing #include 
> <zmq.h> to #include <zmq/zmq.h> personally.

The primary rational is to provide a dedicated location in which developers
can inspect the headers and view the api. One of the first things I do when
working with libraries is turn to the include area and view those headers.

One cannot read the headers if one does not know what they are.  Providing
a private directory for them is a convenience to developers.

When I look at my include area, I see:

$ ls -1 z*

zclock.h
zconf.h
zctx.h
zfile.h
zframe.h
zhash.h
zlib.h
zlist.h
zloop.h
zmq.h
zmq.hpp
zmq_utils.h
zmsg.h
zsocket.h
zsockopt.h
zstr.h
zthread.h

It takes a keen eye to discern that zlib.h is not part of your libraries.  
Worse,
suppose one day you wish to add a header called 'zlib.h'?  Having to worry about
name collisions across the universe of headers is unreasonable with so many 
packages
out there these days.

I hope you'll consider the change.

Phil

Attachment: signature.asc
Description: Digital signature

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to