Brash v1.1.35 Release Notes
30-Mar-2016: UpdatedBrash Issues:
- Bug Fix: getopts command was buggy with respect to multi-character option specifications.
The user was constrained to always using single character options (e.g. -a -b -c) instead of being allowed to combine them. It is now possible to write "-abc" and have it mean "-a -b -c".
This fixed introduced another magic variable, OPTOFF, along side the existing OPTIND, which is part of the normal bourne shell definition of getopts behavior. However, it also automates the saving/restoring of the OPTIND and OPTOFF variables so that it is generally unnecessary to set either one.
The magic variables are as follows:
- OPTIND: The argument number which defines the next potential -option to process. Set to 1 on function calls. The old value is restored on function return.
- OPTOFF: The next character within arg[OPTIND] where the option character interpretation will occur. Set to 0 by function calls. The old value is restored on return.
- OPTARG: Only set when an invalid option is occurred. See other documentation for details.
- Port: Modifications needed for Visual Studio 2015. See below.
- eval exit should exit, but currently it does not.
Source code Changes
The Visual Studio 2015 compiler no longer accepts class members which are mutable references. Apparently, this is a language standards change that they adopted. The CXXTLS_FOREACH macro was taking advantage of this erstwhile feature -- as did BOOST_FOREACH, I believe.Luckily, VS 2015 now supports the new for syntax which acts roughly like foreach in other languages. This made it possible to make a trivial change to the definition of CXXTLS_FOREACH such that it continues to work as before except for one caveat:
It is no longer possible to declare a loop variable outside the CXXTLS_FOREACH block. That, this used to work:In my opinion, this change is unfortunate due to the new inefficiency that will result in the event that the loop variable needs to be used after the loop terminates.string word;
CXXTLS_FOREACH(word, someVectorOfString)
{
}
A second change in the compiler seems more like a compiler bug than a new feature of the language but I may be mistaken. Previously, it was possible to declare multiple function with the following parameters:
void function( Someclass const &description,
char const * const * argv_ptr,
char const * const * environ_ptr,
bool flag=true
);
void function( std::string const &description,
char const * const * argv_ptr,
char const * const * environ_ptr,
bool flag=true
)
This code no longer compiles. Apparently, the visual studio compiler gets confused about overload resolution.
Sigh
Luckily, a void const * can be used in place of the complex pointer declarations, above, and the function bodies can then cast the incoming void const pointers to the proper type and go on its merry way.
The above problems caused several files to change slightly:
- cxx/include/cxxtls/foreach.h
- cxx/include/cxxtls/options.h
- cxx/lib/options.cxx
- cxx/lib/cutset.cxx
The file, cxx/brash/brashBuiltins.cxx, also changed due to additional compiler warnings which required minor adjustments.