Skip to content

Windows: basic compatibilty issues #23

Open
@guestieng

Description

@guestieng

In case there is some interest regarding the usability of CppADCodeGen within Windows (e.g. VS 2015) I'd like to share a few basic compatibilty issues.
In fact, these are rather minor but have quite an impact since they appear in several places throughout all the source code.
Therefore, in the following I list representative examples and suggestions for their principle replacements which should work for both, Windows and Linux (g++):

  1. suggested change of, e.g., std::max(size_t(123), 124) to std::max<size_t>(size_t(123), 124)
    and std::min(size_t(123), 124) to std::min<size_t>(size_t(123), 124), i.e. std::max/std::min should carry a template argument specifying the data type which is relevant for the two passed numbers.

  2. suggested change of, e.g., std::numeric_limits<int>::max() to (std::numeric_limits<int>::max)()
    and std::numeric_limits<int>::min() to (std::numeric_limits<int>::min)()

  3. there exist some problems with the operator <<, it's overloading and the type size_t/__int64 in Windows. This, at least, applies only to recent changes (commit from Jun 13, 2019) and, so far, can be easily fixed in /lang/lang_stream_stack.hpp by adding:

friend inline LangStreamStack<Base>& operator<<(LangStreamStack<Base>& lss, size_t i) {
	return (lss << std::to_string(i));
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions