473,839 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Boost process and C

Hi,

Is there any group in the manner of the C++ Boost group that works on
the evolution of the C language? Or is there any group that performs an
equivalent function?

Thanks,
-vs

Apr 29 '06
335 11904
jacob navia wrote:

The crucial point in this is to know when to stop. There are NO
constructors/destructors in C, and none of the proposed extensions
proposes that.

Besides, I think that using the addition operator to "add" strings is an
ABOMINATION because:

a+b != b+a
"Hello" + "World" != "World" + "Hello"

It just makes NO SENSE.


If C were to have a string type and operator overloading and it didn't
have '+' for strings, the first thing people would do is write one! It
may be syntactic sugar, but it's very convenient sugar.

--
Ian Collins.
May 4 '06 #231
In article <44************ ***********@new s.wanadoo.fr>,
jacob navia <ja***@jacob.re mcomp.fr> wrote:
It just makes NO SENSE. The same thing when you apply the addition
operator to dates: it makes NO SENSE to ADD dates.


mid_date = (start_date + end_date) / 2;

-- Richard
May 4 '06 #232
Richard Tobin a écrit :
In article <44************ ***********@new s.wanadoo.fr>,
jacob navia <ja***@jacob.re mcomp.fr> wrote:

It just makes NO SENSE. The same thing when you apply the addition
operator to dates: it makes NO SENSE to ADD dates.

mid_date = (start_date + end_date) / 2;

-- Richard


Excuse me but what does it mean

Sep-25-1981 + Dec-22-2000

If you figure out what THAT means then please explain.

You obviously meant:
mid_date = (end_date - start_date)/2

The *subtraction* of two dates yields a time interval
May 4 '06 #233
Ian Collins a écrit :
jacob navia wrote:
The crucial point in this is to know when to stop. There are NO
constructor s/destructors in C, and none of the proposed extensions
proposes that.

Besides, I think that using the addition operator to "add" strings is an
ABOMINATION because:

a+b != b+a
"Hello" + "World" != "World" + "Hello"

It just makes NO SENSE.

If C were to have a string type and operator overloading and it didn't
have '+' for strings, the first thing people would do is write one! It
may be syntactic sugar, but it's very convenient sugar.


Well, in this same thread Chris Torek posted this:

String a = ((b + c) - "zog") * " ";

where string "addition" means "concatenat e" (the usual definition
for string addition), "subtractio n" means "remove the first copy
of the target string, if there is one", and string "multiplication "
means "repeatedly insert this string". Hence if b and c hold "xyz"
and "ogle" respectively, the "sum" is "xyzogle", subtracting "zog"
yields "xyle", and multiplying by " " yields "x y l e " (including
the final space).

:-)
May 4 '06 #234
Flash Gordon wrote:
we******@gmail. com wrote:
Flash Gordon wrote:
we******@gmail. com wrote:
Ben C wrote:
> On 2006-05-03, we******@gmail. com <we******@gmail .com> wrote:
>> CBFalconer wrote:
>>> we******@gmail. com wrote:
>>>> CBFalconer wrote:
>>> ... snip ...
>>>>> The last time I took an (admittedly cursory) look at Bstrlib, I
>>>>> found it cursed with non-portabilities
>>>> You perhaps would like to name one?
>>> I took another 2 minute look, and was immediately struck by the use
>>> of int for sizes, rather than size_t. This limits reliably
>>> available string length to 32767.
> [snip]
>
>>> [...] I did find an explanation and
>>> justification for this. Conceded, such a size is probably adequate
>>> for most usage, but the restriction is not present in standard C
>>> strings.
>> Your going to need to conceed on more grounds than that. There is a
>> reason many UNIX systems tried to add a ssize_t type, and why TR 24731
>> has added rsize_t to their extension. (As a side note, I strongly
>> suspect the Microsoft, in fact, added this whole rsize_t thing to TR
>> 24731 when they realized that Bstrlib, or things like it, actually has
>> far better real world safety because its use of ints for string
>> lengths.) Using a long would be incorrect since there are some systems
>> where a long value can exceed a size_t value (and thus lead to falsely
>> sized mallocs.) There is also the matter of trying to codify
>> read-only and constant strings and detecting errors efficiently
>> (negative lengths fit the bill.) Using ints is the best choice
>> because at worst its giving up things (super-long strings) that nobody
>> cares about,
> I think it's fair to expect the possibility of super-long strings in a
> general-purpose string library.
Ok, so you can name a single application of such a thing right?
Handling an RTF document that you will be writing to a variable length
record in a database. Yes, I do have good reason for doing this. No, I
can't stream the document in to the database so I do have to have it all
in memory. Yes, RTF documents are encoded as text. Yes, they can be
extremely large, especially if they have graphics embedded in them
encoded as text.
So now name the platform where its *possible* to deal with this, but
where Bstrlib fails to be able to deal with them due to its design
choices.


If the DOS port hadn't been dropped then depending on the compiler we
might have hit this. A significant portion of the SW I'm thinking of
originated on DOS, so it could have hit it.


Oh ... I think of DOS as exactly the case where this *can't* happen.
Single objects in 16bit DOS have a size limit of 64K (size_t is just
unsigned which is 16 bits), so these huge RTF files you are talking
about *have* to be streamed, or split over multiple allocations
anyways.
>> it allows in an efficient way for all desirable encoding scenarios,
>> and it avoids any wrap around anomolies causing under-allocations.
> What anomalies? Are these a consequence of using signed long, or
> size_t?
I am describing what int does (*BOTH* the encoding scenarios and
avoiding anomolies), Using a long int would allow for arithmetic on
numbers that exceed the maximum value of size_t on some systems (that
actually *exist*), so when there was an attempt to malloc or realloc on
such sizes, there would be a wrap around to some value that would just
make it screw up. And if I used a size_t, then there would be no
simple space of encodings that can catch errors, constants and write
protected strings.
Is an extra byte (or word, or double word) for a flags field really that
big an overhead?


I need two *bits* for flags, and I want large ranges to catch errors in
the scalar fields (this is a *safe* library). An extra struct entry is
the wrong way to do this because it doesn't help my catch errors in the
scalar fields, and its space inefficient.

ssize_t would have been a reasonable *functional* choice, but its not
standard. size_t is no good because it can't go negative. long int is
no good because there are plenty of real platforms where long int is
larger than size_t. int solves all the main real problems, and as a
bonus the compiler is designed to make sure its the fastest scalar
primitive available.


Strangely enough, when a previous developer on the code I'm dealing with
thought he could limit size to a "valid" range an assert if it was out
of range we found that the asserts kept getting triggered. However, it
was always triggered incorrectly because the size was actually valid!


And how is this connected with Bstrlib? The library comes with a test
that, if you run in a 16 bit environment, will exercise length
overflowing. So you have some reasonable assurance that Bstrlib does
not make obvious mistakes with size computations.
[...] So I'll stick to not artificially limiting sizes.
And how do you deal with the fact that the language limits your sizes
anyways?
[...] If the administrator of a
server the SW is installed on wants then s/he can use system specific
means to limit the size of a process.


What? You think the adminstrator is in charge of how the compiler
works?

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

May 4 '06 #235
In article <44************ **@jacob.remcom p.fr>,
jacob navia <ja***@jacob.re mcomp.fr> wrote:
mid_date = (start_date + end_date) / 2;
Excuse me but what does it mean

Sep-25-1981 + Dec-22-2000
Just because the sum of two dates is not a date doesn't mean that
it doesn't mean anything.
You obviously meant:

mid_date = (end_date - start_date)/2
No I didn't. That is something completely different.
The *subtraction* of two dates yields a time interval


True, and (end_date - start_date) / 2 would give me half the interval
between the dates, but that is not what I wanted. I wanted the
average of the dates, which is a date.

(Sep-25-1981 + Dec-22-2000) / 2 would be the date mid-way between
Sep-25-1981 and Dec-22-2000, just as (45 + 78) / 2 is the integer
mid-way between 45 and 78.

-- Richard
May 4 '06 #236
Richard Tobin a écrit :
In article <44************ **@jacob.remcom p.fr>,
jacob navia <ja***@jacob.re mcomp.fr> wrote:

mid_date = (start_date + end_date) / 2;


Excuse me but what does it mean

Sep-25-1981 + Dec-22-2000

Just because the sum of two dates is not a date doesn't mean that
it doesn't mean anything.

You obviously meant:

mid_date = (end_date - start_date)/2

No I didn't. That is something completely different.

The *subtraction* of two dates yields a time interval

True, and (end_date - start_date) / 2 would give me half the interval
between the dates, but that is not what I wanted. I wanted the
average of the dates, which is a date.

(Sep-25-1981 + Dec-22-2000) / 2 would be the date mid-way between
Sep-25-1981 and Dec-22-2000, just as (45 + 78) / 2 is the integer
mid-way between 45 and 78.

-- Richard


Ahh ok, you mean then

mid_date = startdate + (end_date-start_date)/2

A date + a time interval is a date later than the start date.
May 4 '06 #237
Flash Gordon wrote:
we******@gmail. com wrote:
Flash Gordon wrote:
jacob navia wrote:
Flash Gordon a écrit :
> Is an extra byte (or word, or double word) for a flags field really
> that big an overhead?
Well, I have that extra "Flags" field in the string library of
lcc-win32. I have the size as a size_t as you propose, and I need 32
bits for the flags.

The problem is that 32 bits is quite a lot for a few bits info... For
programs that use extensively strings, 32 bits multiplied by several
thousand small strings can make a big difference in RAM used, specially
for the more common short strings.

I see the point of Bstrlib, and it is a very valid design decision.
I've yet to see software where short strings made up a significant
portion of the memory footprint and saving the memory that avoiding the
flags would be of real use. Of course, such applications might exist.
Any program that reads words from any language dictionary. Like a
spell checker, or a word puzzle solver/creator, or a spam filter. For
dictionaries the size of the english language dictionary, these kinds
of applications can typically push the L2 cache of your CPU pretty
hard.


I never said they didn't exist.


I think the point is that there are *many* such application. In fact I
would be suspicious of anyone who claimed to be an experienced
programmer who hasn't *written* one of these.
[...] However, a typical dictionary + the
structures is not going to fit in my L2 cache anyway. However, the
subset of it that is likely to be actually in use is probably an order
of magnitude smaller and so could easily fit in with the extra overhead.
Its more *likely* if the data is compacted. Another way of saying
this, is that for any overflowing data set with a locality bias with
perform better monotonically with how well it fits in the cache. I.e.,
everything you save improves some percentage of performance.
Alternatively, one could go to conventional C strings and have a bigger
chance of it fitting since they only have a 1 byte overhead compared to
probably an 8 byte overhead (4 byte int for lenght, 4 byte int for
memory block size) that it sounds like your library has. Even if your
library only has a 4 byte overhead it is still larger!
Yes, but you eat a huge additional O(strlen) penality for very *many*
typical operations. So Bstrlib makes the trade off where the more
common scenarios are faster.
Personally I would say that using negative lengths was asking for
problems because at some point a negative length will be checked without
first changing it to positive.


I think you miss the point. If the string length is negative then it
is erroneous. That's the point of it. But the amount of memory
allocated being negative, I use to indicate that the memory is not
legally modifiable at the moment, and being 0 meaning that its not
modifiable ever. The point being that the library blocks erroneous
action due to intentionally or unintentionally having bad header values
in the same test. So it reduces overhead, while increasing safety and
functionality at the same time.


If you are trying to detect corruption then you should also be checking
that the length is not longer than the memory block, so you should be
doing more than one comparison anyway.


Yes, it does that as well. So you really are talking out of your ass.
This is in the first couple pages of the documentation, and strewn
throughout the source code.
[...] Then you can easily check if any unused flag bits are non-0.


Yes, this is an alternative -- but its less safe and slower, so why
would I do it this way?
You know, you can actually read the explanation of all this in the
documentation if you care to do so.


Probably true.

It may well be that the performance gain is worth it for the
applications people use your library for. If so then fine, but the
limitation means it is not worth me migrating to it.


Probably not true. But you won't look at it anyways, so I won't waste
my breath.

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

May 4 '06 #238
In article <44************ ***********@new s.wanadoo.fr>,
jacob navia <ja***@jacob.re mcomp.fr> wrote:
mid_date = (start_date + end_date) / 2;
Ahh ok, you mean then

mid_date = startdate + (end_date-start_date)/2


Your attitude is baffling. You deny that adding dates makes sense,
and when I post an example where adding dates makes perfect sense, you
respond by asserting that I mean some other expression that achieves
that same effect. The mere fact that you were able to post another
expression with the same meaning refutes your original claim.

-- Richard
May 4 '06 #239
In article <e3**********@p c-news.cogsci.ed. ac.uk>, I wrote:
Just because the sum of two dates is not a date doesn't mean that
it doesn't mean anything.


Just in case anyone has not noticed, this is really just a re-run of
pointer addition with dates instead of pointers.

The reason for not allowing (date|pointer) addition is not that it
doesn't make sense, but that the gain isn't worth the mechanism
required.

-- Richard
May 4 '06 #240

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
5406
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++ language. A C++ interface installation IS ABOUT THE C++ LANGUAGE! The language does not possess the ability to handle even simple file directory manipulation. Those wise people that created it did not take care of it. So, BOOST is a portable...
205
10760
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
17
1902
by: Howard Gardner | last post by:
/* If I am using boost, then how should I write this program? As it sits, this program is using SFINAE to determine whether or not a type supports particular syntax. I suspect that there is functionality in boost to do this. I have found mpl::has_xxx, which I suspect of being part of the solution. I've also found type_traits::has_nothrow_constructor
2
6636
by: smith4894 | last post by:
{ not sure you're aware of that but there are the newsgroups for all major operating systems. you might want to try asking in the forum 'comp.os.linux.development.apps', since memory-mapped files are not a language-supported structure, they are platform-specific. -mod } I'm trying to use boost serialization to serialize/deserialize data to and from a mmap'd file. I have my own ostream/istream classes that essentially read/write bytes...
5
2400
by: linyanhung | last post by:
I used a boost multi thread in VS 2005 on a Duo Core PC, and made a two thread process. The code is something like this: #include <boost/thread/thread.hpp> void fun1() { //do something
8
6214
by: Matt England | last post by:
My team currently using Boost Threads, but we are considering switching to ZThreads. (We seek cross-platform, C++ multithreading capabilities in an external library.) ZThread(s): http://zthread.sourceforge.net/ http://www.inf.uni-konstanz.de/dbis/members/vinnik/zsim/doc/ Can anyone share their ZThreads experience, either good, bad, or
2
2417
by: ironpingwin | last post by:
Hi! I'd like to make few threads which will run in the same time in C++. I try to use boost library v 1.34.1 (it can't be newest, because I compile on remote machine, which is not administrated by me). In this version there isn't detach() function. How to run functions from two different class in the same time?
13
4541
by: brad | last post by:
Still learning C++. I'm writing some regex using boost. It works great. Only thing is... this code seems slow to me compared to equivelent Perl and Python. I'm sure I'm doing something incorrect. Any tips? #include <boost/regex.hpp> #include <iostream> // g++ numbers.cpp -o numbers -I/usr/local/include/boost-1_35 /usr/local/lib/libboost_regex-gcc41-mt-s.a // g++ numbers.cpp -o numbers.exe
5
3596
by: ameyav | last post by:
Hi All, I am converting some C code into C++ code. The objective is to improve throughput. I have some code written in C which serially parses through a list of files, opens each one of them, processes the data and closes the file. All the files are processed one by one. The obvious performance bottleneck that i could think of is the wasted cpu cycles for file i/o. *My solution* was to spawn multiple threads to do the file i/o. For...
0
9854
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9696
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10290
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9425
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7827
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7015
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4482
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3131
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.