Why should it be included in the Standard (new or old) when any
implementation is free to provide its own way of dealing with those?
Signals aren't really normative, are they?
Signals are normative. There is lots of informative left out of the
normative (standard).
Access to null pointer has undefined behaviour. The implementation is
free to define it. Some do. Some don't. There is no need to introduce
limitations by specifying what should happen.
> In this case
Whatever. If you're using a sophisticated operating system that allows
you to handle such a situation, be happy. You seem unhappy for some
reason. Do you want your Windows application with all the SEH stuff be
runable on MS-DOS? And you want the language to provide the means? I
do not see this as reasonable.
Slows it down? By how much? I've worked in systems that were set up to
handle FP exceptions and invalid pointer access... If you want it done
right, every damn function has to be littered with try/catch for those.
It is much, MUCH, easier to make sure you never try to calculate a
logarithm of a negative value or you never hang onto a dangling pointer.
A test for greater than 0 is so much quicker than setting everything
up for stack unwinding...
But you don't have to listen to me. If you see how Microsoft Structured
Exceptions can be brought into the language and implemented everywhere
the C++ compilers can exist, do write it up. I am sure folks in
comp.std.c++ will read your proposal with the same attention they give
every proposal.
V
It seems reasonable as a pattern to encapsulate generic exception
handling in the C++ towards that it is instrumentable generally.
Here are some of my ideas from the other day about cwd: current
working directory. When considering how to handle the exceptions
generally, catch the signals and throw them back to the functions
maybe having each function register itself as the signal handler, in
the generic exception handling logic.
Also I am thinking some about "generic return types" and also
generifed return types in terms of considering what C++ can do for me.
To truncate the file specifications might be great, with the automatic
matching of the free input component.
static cwd here
put static functions on cwd, then use here for the file functions,
file_system_point
class cwd
{
std::string directory; // this is the current working directory
directory
}
use the inline functions, anonymous functions, to, defer
initialization of the carry-over variable
if there's no initial match, it's set to zero
here, the point is to collect several modes of the strings, basically
having the modes saved in the static variables
so, the path comes in, is it a delta off of the working directory, or
absolute / rooted?
basically for the path root, there is either the working directory as
the root or the path contains its own root (which might include
volume, host, etcetera, which would have static process events on
events with those).
So, I want to get the path, and compare it to the working directory.
If it's relative the working directory, then truncate it's initial
matching segments, the parameter, for later calls using the same
initial segment.
Then set up mode arrays, with this path construction and validation
generally throughout with public APIs.
So, the mode strings should be any number of matching initial segments
and patterns.
Then, among those are to be the collapse and the matching of the
segments / strings.
Make the path components, similar to the path segments, with getting
out the names.
So, to match the working directory, it's towards where the actual
parameters can be reduced, until, they have to be assembled already to
access the device or so, here relative to particular points they have
more direct addressing which carries down to all the functions
underneath, where for example there is a static main process working
directory object that the static function members initialize to.
Then, it is more about instrumenting the function with automatically
recognizing its input types, memoizing its inputs, than it is about
particularly the working directory as a process level point
representing a local root for general purposes that has then those
parameters being in a reduced form as they pass through the standard
APIs.
/*
cwd, current working directory, helper
*/
#include <unistd.h>
int ret_getcwd(char* getcwd_, char* buf, size_t size)
{
// if it's a null pointer, there was an error
// get errno, mutex on errno
switch(errno)
{
case EINVAL: // The size argument is 0.
// retry the function with a different size argument
case ERANGE: // The size argument is greater than 0, but is smaller
than the length of the pathname +1.
case EACCES: // Read or search permission was denied for a component
of the pathname.
case ENOMEM: // Insufficient storage space is available
}
}
class getcwd_ret_t
{
size_t m_buf_size = MAX_PATH; // restrict to expected with retry
char* m_buf[m_buf_size];
int m_errno;
getcwd_ret_t(*void getcwd_= getcwd)
: m_errno(0)
{
char* buf = getcwd_(m_buf, m_buf_size);
// test here
}
bool retryable(int m_errno)
{
// the errno is set
}
// ret is either OK or not OK
operator !()
{ // check also if m_buf is valid pointer, here is automatic
return (m_buf != 0) || retryable(m_errno);
}
// ret is insertable in chaining functions
operator char*(char*& c)
{
return c = m_buf;
}
operator=(void) // function pointer of same type as getcwd
{
// here install via templates
}
};
#define getcwd() getcwd_ret_t ret =
class cwd
{
std::string m_directory; // this is the current working directory
directory
public cwd()
{
size_t buf_size = MAX_PATH;
char* buf[buf_size];
getcwd(buf, buf_size); // build in ret
m_directory(buf,buf_size); // construct better with size
}
static assign_to(const std::string& s); // sets the CWD for the
function call, no,
static assign_to(const char* s); // sets the CWD for the function
call,
static is_equal(const std::string& s); // sets the CWD for the
function call
static is_equal(const char* s); // sets the CWD for the function call
operator = (const
}
/*
Here the idea is to know the cwd, it is static, or no? It's not
really static, in the sense that it's process level.
The cwd is often static, where the automatic constructors of the
getcwd type functions would install a callback
so changing the cwd could be indicated to change them.
Anyways they are static working directories, or simply the closest
matching input of the previous.
So, they are influenced by the parameters, because, the function
should be about whatever is the mode of the string.
So, I want it to get the cwd, doing so in a fair manner, and when
should it reset the static?
*/
/*
*/
class open_flags
{
};
class path_segment : public string
{
};
class root // encapsulates a tree root (path root)
{
};
class path_limits
{
// PATH_MAX, NAME_MAX
}
class path // encapsulates a file path
{
path(std::string s);
path(const char* c);
path(char* c);
// these, C and C++ runtime types, specialize for platform
path(fstream& f);
path(FILE* fp);
path(filedes_t fd);
bool exists(); // object exists with this path?
fstream* open(open_flags f); // pointer to new fstream with path and
flags
operator std::string ();
operator char* ();
std::list<path_segment> m_segments; // expose iterators over the
segments, address at offset, bracketize
// templatize functions outputting iterators on type generators
// path components are string
iterator& names_begin(); // there is list of names but also other
objects
iterator& names_end(); // there is list of names but also other
objects
// path segments are paths
iterator& segments_begin();
iterator& segments_end();
};
// construct the path as a string, it needs the tree sequencing for
mapping and the path combinations
class url
{
// it's like a path, has a path, query string
}
// here find the matching initial segments of the parameter and static
path, finding the difference
initial_match(string parameter, path static_path)
{
}
f
// return true and the match size and contents without realizing
except as necessary
// the matching string is matched to the matched string
ret_t initial_match(string matching, string matched)
{
// use STL
string::iterator matching_i = matching.begin();
string::iterator matched_i = matched.begin();
while(*matching_i == *matched_i)
{
++matching_i;
++matched_i;
// test for end to break
// they both end at once or neither? no dereferencing end
}
// truncate matched
matched.resize()
}
ret_t test_path(string file_name)
{
static path path_root; // cwd, current working directory
static path path_mode; // parameter mode
// mode is matching initial segment
path_mode = initial_match(file_name, path_mode);
// truncate the parameter,
file_name = file_name.substr(initial_match_length);
// for strings that aren't freed in this function, increment/reset
the pointer
// for strings freed in this function, delete and make new or
otherwise pass in iterator, reset beginning
// did the cwd change // now standard library calls see the input
rel. the cwd
}
// bracketize file name in path segment component, with generating
matchers of
// input across mode and selectors with small special character lists
and default