[ 
https://issues.apache.org/jira/browse/PROTON-159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cliff Jansen updated PROTON-159:
--------------------------------

    Attachment: proton-159-0.diff

To test drive, apply the patch and

  cmake -DBUILD_WITH_CXX=ON [ plus your regularly scheduled cmake args]


The patch intent was

  minimal change to the generated C99 code
  minimal change to the original source code
  VLA repurposing as per Rafi's comments in PROTON-57

The issues encountered varied from boring to mildly challenging

  explicit cast fussiness
  const fussiness
  signed/unsigned/size_t comparison fussiness
  aggregate assignments
  CMake magic dust
  %z, and PRIxxx in printf
  VLAs
  redefinition of pn_dtag (ick, an interface in engine.h)
  redefinition of PN_ENSURE for type cast fussiness yet again


The VLAs were replaced depending on context:

  malloc if perf not an issue and free obvious
  other-wise stack if normal case fits, and heap if too big (to avoid perf hit)
  stack only with fail check (if failure cases very rare)
  PN_ENSURE if re-useable scratch space makes most sense

PRIxxx was handled by a new sys/io.h header file

%z was handled by the introduction on pn_fprintf.  For g++, just hide the %z 
via the intermediate function call.  Presumably Microsoft Visual Studio will 
require a substituted format string with their size_t equivalent.


This patch is strongly related to information provided or discussed in 
PROTON-57, PROTON-67, PROTON-98, PROTON-99, PROTON-148.
                
> port proton to C++
> ------------------
>
>                 Key: PROTON-159
>                 URL: https://issues.apache.org/jira/browse/PROTON-159
>             Project: Qpid Proton
>          Issue Type: New Feature
>          Components: proton-c
>    Affects Versions: 0.3
>            Reporter: Cliff Jansen
>         Attachments: proton-159-0.diff
>
>
> Make code compile in both C99 and C++, using the gnu toolchain.  This is a 
> necessary first step
> towards a Microsoft Visual Studio port (where the compiler supports C++ but 
> not C99).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to