Tuesday, May 19, 2020

Digest for comp.lang.c++@googlegroups.com - 24 updates in 5 topics

Tim Rentsch <tr.17687@z991.linuxsc.com>: May 19 03:13PM -0700

> different meaning in the two languages_, should take the C
> meaning when inside the extern "C" { ... } brackets."
 
> If you have changed your mind meanwhile, then that's OK.
 
The quoted statement is perfectly consistent with what I said
before. All code inside extern "C" { ... } brackets is to be
compiled using C syntax and C semantics. That includes code that
happens to be valid C++, as well as code that is not valid C++.
Usually I think of you as a pretty perceptive guy. Do you really
not get this, or are you playing dumb? I mean, if you want to
disagree about whether the proposal is a good idea, that's fine,
but first I would like to be sure what you're reacting to is in
fact what it is that I am proposing.
Tim Rentsch <tr.17687@z991.linuxsc.com>: May 19 03:45PM -0700


> You consider Statement B significantly different from Statement C?
 
> Could the two of you explain the differences that you see between those
> statements? [...]
 
The last statement, C, is consistent with my earlier statement,
B. They are different only in that statement C is a subset
of statement B.
 
In answer to your previous question, I can't say how statement A
is different from statement B, because I'm not sure what A means.
My comment was meant to say only that statement A is not what I
said, because it isn't what I said.
"Ainė Paplauskaitė" <ainepaplauskaite@gmail.com>: May 19 03:21PM -0700

Hello! I am making Hangman game with FLTK. I have a problem - I would like my function to compare each letter of the string word_4 to a certain character(entered from input widget). For example, my string word is "sun" and I would like to compare the first letter with the entered letter(from input). So I need to compare 's' with string 's'.
There is part of the code:
 
struct Dictionary
{
string Word_4[150];
string file_4;
string word_4;
};
 
struct Info
{
Fl_Input* instr;
char sval[40];
};
 
void readLetter_4(string Word_4[], string &word_4){
 
vector<string> words;
ifstream file("letter_4.txt");
string line;
if (!file)
printf("File does not exist");
else
while (getline(file, line))
{
words.push_back(line);
srand(time(0));
}
 
word_4 = words[rand() % words.size()];
file.close();
}
 
void showLetters_cb(Fl_Widget* w, void* param) {
 
string word_4; string Word_4[150];
Info* input= reinterpret_cast<Info*>(param);
strcpy(input->sval, input->instr->value());
readLetter_4(Word_4, word_4);
 
if (word_4.at(0) == (input->sval)) //this does not work
{
raide14->value(zodis_4.at(0));
}

/*if (word_4[1] == (limput->sval)) //This kind of comparing does not work. How could I fix this?
{
raide14->value(word_4 + 1, 1);
}
 
}*/
 
}
rick.c.hodgin@gmail.com: May 18 07:28PM -0700

[Jesus Loves You]
Dragons, Dinosaurs and the Bible
 
Evidence from around the world:
 
https://www.youtube.com/watch?v=VD5ubFZPf0A
 
What does the Bible say the Earth was like at creation? And is
there any evidence supporting the Biblical narrative?
Rather a lot really.
 
--
Rick C. Hodgin
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: May 19 11:00PM +0100


> What does the Bible say the Earth was like at creation? And is
> there any evidence supporting the Biblical narrative?
> Rather a lot really.
 
Fuck. Off.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."
David Brown <david.brown@hesbynett.no>: May 19 10:19AM +0200

On 18/05/2020 20:13, Mr Flibble wrote:
> Hi!
 
> When is C++ getting strong typedefs? I want strong typedefs!
 
The trouble with adding "strong typedefs" to C++ is that people have
very different ideas about what they mean by "strong typedefs". Many
people (including me) agree that they want strong typedefs in the
language, but disagree on /how/ strong, and on many of the details.
(There are lots of proposals for adding the feature to the language -
I'm sure you can google these as well as anyone else.)
 
For integer types, "enum class" may give you what you need.
 
 
There are also various template based solutions - you may or may not
find them suitable:
 
<https://foonathan.net/2016/10/strong-typedefs/>
 
 
And there is always boost, if you don't mind the macros.
Sam <sam@email-scan.com>: May 19 07:07AM -0400

Mr Flibble writes:
 
> Hi!
 
> When is C++ getting strong typedefs? I want strong typedefs!
 
So, make your own. I did, it wasn't very hard at all.
Bonita Montero <Bonita.Montero@gmail.com>: May 19 02:21PM +0200

Use BOOST_STRONG_TYPEDEF.
Thiago Adams <thiago.adams@gmail.com>: May 19 05:34AM -0700

On Monday, May 18, 2020 at 3:13:12 PM UTC-3, Mr Flibble wrote:
> Hi!
 
> When is C++ getting strong typedefs? I want strong typedefs!
 
[[ironic]]
 
Yes. But this feature is too simple. No one wants to propose or
implement this.
 
Meanwhile, concepts are implemented.
 
(I guess C++ is following a web browser strategy.
Make a so complex standard in a way just few companies are
able to implement it.)
David Brown <david.brown@hesbynett.no>: May 19 04:06PM +0200

On 19/05/2020 14:34, Thiago Adams wrote:
 
> [[ironic]]
 
> Yes. But this feature is too simple. No one wants to propose or
> implement this.
 
It turns out that strong typedefs are very hard to define and pin down
exactly what people mean by the term.
 
 
> (I guess C++ is following a web browser strategy.
> Make a so complex standard in a way just few companies are
> able to implement it.)
 
Concepts are not that hard to use, and simplify code and error messages.
What's your problem with them?
Thiago Adams <thiago.adams@gmail.com>: May 19 07:59AM -0700

On Tuesday, May 19, 2020 at 11:06:18 AM UTC-3, David Brown wrote:
> > implement this.
 
> It turns out that strong typedefs are very hard to define and pin down
> exactly what people mean by the term.
 
Just add a warning inside the compiler.
 
typedef int BOOL;
 
BOOL F() {
return E_FAIL; //WARNING.. E_FAIL IS NOT A BOOL
}
 
int main() {
F();
}
 

> > able to implement it.)
 
> Concepts are not that hard to use, and simplify code and error messages.
> What's your problem with them?
 
It is not necessarily a problem, but my opinion about
c++ priorities.
 
Concepts were in the last position in my top 100 for instance.
Modules as well.
 
Unfortunately, my priorities are much different from C++
committee.
 
I would like simple multi platform libs for sockets, console
for instance.
The Real Non Homosexual <cdalten@gmail.com>: May 19 08:10AM -0700

On Tuesday, May 19, 2020 at 7:59:52 AM UTC-7, Thiago Adams wrote:
> committee.
 
> I would like simple multi platform libs for sockets, console
> for instance.
 
Your no talent monkey ass missed the argument. Maybe you should consider something else since it appears computers don't quite to be your thing
The Real Non Homosexual <cdalten@gmail.com>: May 19 08:14AM -0700

I swear Thiago makes fir over at comp.lang.c look smart.
David Brown <david.brown@hesbynett.no>: May 19 05:25PM +0200

On 19/05/2020 16:59, Thiago Adams wrote:
 
> int main() {
> F();
> }
 
The idea of "strong typedef" is a bit more complicated than that...
 
> Modules as well.
 
> Unfortunately, my priorities are much different from C++
> committee.
 
C++ is used on a /huge/ range of program types. The priorities picked
by the C++ committee will never match the priorities of any one
programmer. This is especially true because the priorities are guided
by practicalities - the community debates on ideas and details before
deciding on how a feature will be implemented, and nothing makes it into
the standards before there is a certain level of agreement.
 
It has taken something like 20 years for concepts and modules to make it
to the top of the list - it's not a rush job.
 
 
> I would like simple multi platform libs for sockets, console
> for instance.
 
These would be almost totally and completely useless to me. Different
people have different priorities.
 
And this stuff can all be implemented as libraries - so people can try
it out and see if particular libraries become popular and useful before
standardising. Concepts and modules are language changes.
Thiago Adams <thiago.adams@gmail.com>: May 19 08:48AM -0700

On Tuesday, May 19, 2020 at 12:10:54 PM UTC-3, The Real Non Homosexual wrote:
 
> > I would like simple multi platform libs for sockets, console
> > for instance.
 
> Your no talent monkey ass missed the argument. Maybe you should consider something else since it appears computers don't quite to be your thing
 
Did you take your medicine today?
Jorgen Grahn <grahn+nntp@snipabacken.se>: May 19 04:08PM

On Tue, 2020-05-19, David Brown wrote:
 
>>> It turns out that strong typedefs are very hard to define and pin down
>>> exactly what people mean by the term.
 
>> Just add a warning inside the compiler.
...
 
> The idea of "strong typedef" is a bit more complicated than that...
 
To me it appears simple: 'typedef foo bar', and bar will be exactly
like foo, except there will be no conversions between them. But I see
no use case for such a thing ...
 
The one time in the past when I wanted something like that, it
turned out I really wanted my own template class. I remember asking
here about it in 2009 or so ... I wrote a protocol encoder/decoder
for GTPv2, and the protocol carried a lot of tag-length-value data
which often was some tag, length 4 and a value which was a 32-bit
integer. I ended up with the tag as the template argument, and
typedefs like
 
typedef Element32<4711> UPTunnelId;
 
...
 
> And this stuff can all be implemented as libraries - so people can try
> it out and see if particular libraries become popular and useful before
> standardising.
 
And that hasn't happened yet. For sockets I'm happy with BSD sockets;
they are well-known, work on all machines I care about, and are
documented in manpages and Stevens' books. I'm not that impressed
with Qt's sockets or with Boost.Asio. They are useful, but I wouldn't
want them standardized.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Thiago Adams <thiago.adams@gmail.com>: May 19 09:08AM -0700

On Tuesday, May 19, 2020 at 12:25:36 PM UTC-3, David Brown wrote:
...
> by practicalities - the community debates on ideas and details before
> deciding on how a feature will be implemented, and nothing makes it into
> the standards before there is a certain level of agreement.
 
I wish we had a public poll about features by sector like
games, industry, embedded etc.
The Real Non Homosexual <cdalten@gmail.com>: May 19 09:09AM -0700

INDONT Tuesday, May 19, 2020 at 8:49:18 AM UTC-7, Thiago Adams wrote:
> > > for instance.
 
> > Your no talent monkey ass missed the argument. Maybe you should consider something else since it appears computers don't quite to be your thing
 
> Did you take your medicine today?
 
I don't think you fully grasp the concept and/or purpose of strong typedes. Presumably because you're a neanderthal. Now shut up and take heed to David Brown's comment.
Thiago Adams <thiago.adams@gmail.com>: May 19 09:14AM -0700

On Tuesday, May 19, 2020 at 1:08:43 PM UTC-3, Jorgen Grahn wrote:
...
> documented in manpages and Stevens' books. I'm not that impressed
> with Qt's sockets or with Boost.Asio. They are useful, but I wouldn't
> want them standardized.
 
I also don't want asio etc.
 
Just BSD sockets but multiplatform with the small
differences fixed.
For instance on linux we have errno and on windows WSAGetLastError.
The Real Non Homosexual <cdalten@gmail.com>: May 19 11:11AM -0700

On Tuesday, May 19, 2020 at 9:14:48 AM UTC-7, Thiago Adams wrote:
 
> Just BSD sockets but multiplatform with the small
> differences fixed.
> For instance on linux we have errno and on windows WSAGetLastError.
 
The Linux implemention sucks compared to BSD. But I'm sure that a talented programmer like yourself is aware of these subtle but important differences.
Jorgen Grahn <grahn+nntp@snipabacken.se>: May 19 08:50PM

On Tue, 2020-05-19, Thiago Adams wrote:
 
> Just BSD sockets but multiplatform with the small
> differences fixed.
> For instance on linux we have errno and on windows WSAGetLastError.
 
The problem is, I think, more in how you handle the I/O from a whole
program perspective. Threads, fork, select, poll, epoll, mixing
sockets with other event sources ...
 
But like I hinted at above, I'm not interested in Windows, so
personally I have no problem.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Keith Thompson <Keith.S.Thompson+u@gmail.com>: May 19 02:29PM -0700

> On Tuesday, May 19, 2020 at 11:06:18 AM UTC-3, David Brown wrote:
[...]
 
> BOOL F() {
> return E_FAIL; //WARNING.. E_FAIL IS NOT A BOOL
> }
 
Changing the existing meaning of typedefs is a non-starter.
Existing code can reasonably rely on a typedef creating an alias
for an existing type, not a new type. And I don't think there are
any existing features that require a warning while disallowing a
fatal error message.
 
I'd like to see something that might reasonably be called "strong
typedefs", but it needs to be a new feature.
 
And I doubt that you could get universal agreement on whether
something like this:
 
strong_typedef int mytype;
mytype obj = 42;
 
should require a diagnostic.
 
For integral types, you *probably* want to create a type that's
distinct from existing types in the same way that int and long are
distinct from each other (even if they have the same representation).
But that implies that you have implicit conversions to and from
other numeric types.
 
So you likely want the ability to create a new integer type with
implicit conversions *and* the ability to create an new integer
type without implicit conversions.
 
Implementing this in a compiler probably isn't too difficult. The hard
part is defining the feature in the first place.
 
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */
woodbrian77@gmail.com: May 19 09:48AM -0700

On Sunday, May 17, 2020 at 11:14:24 PM UTC-5, Real Troll wrote:
> Drupal which as extensions for that sort of things.
 
> Just take one thing at a time.  Setup a website first then worry about
> other things.
 
One day at a time. One hour at a time.
One minute at a time. One line of code
at a time, but it should be C++. Is that
too much to ask?
Daniel P <danielaparker@gmail.com>: May 19 12:38PM -0700


> One line of code at a time, but it should be C++. Is that
> too much to ask?
 
Yes. Render to C++ the things that are C++'s; and to PHP the things that are
PHP's.
 
Daniel
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: