Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #81887
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Can extern "C" functions throw exceptions |
| Date | 2021-10-06 16:12 -0700 |
| Organization | None to speak of |
| Message-ID | <87pmsh7nnu.fsf@nosuchdomain.example.com> (permalink) |
| References | (1 earlier) <shi5g0$9cu$1@dont-email.me> <shib96$j4b$2@dont-email.me> <shigaa$rva$1@dont-email.me> <7c6c3418-f54f-40dd-ba84-9b6b56bec1d2n@googlegroups.com> <zSn7J.26020$nh7.4345@fx22.iad> |
Branimir Maksimovic <branimir.maksimovic@icloud.com> writes:
> On 2021-10-06, daniel...@gmail.com <danielaparker@gmail.com> wrote:
>> On Saturday, September 11, 2021 at 11:00:42 AM UTC-4, Alf P. Steinbach wrote:
>>
>>> And these are the guys creating a Windows calculator
>>> that by default evaluates 2+3*4 as (2+3)*4.
>>
>> In Standard mode, but not in Scientific or Programmer mode :-)
> --main = print $ calculate "3 * 2 + 5 / 2"
>
> calculate :: String -> String
> calculate str = case (eval operatorRegister . words) str of
> Just r -> printf "%.2f" (fromRational r::Double)
> Nothing -> "Nothing"
>
> eval :: Register -> [String] -> Maybe Rational
> eval [] _ = Nothing -- No operator found.
> eval _ [] = Nothing -- If a operator don't have anything to operate on.
> eval _ [number] = let a :: Maybe Double = readMaybe number
> in case a of
> Just a -> Just (toRational a)
> Nothing -> Nothing
> eval ((operator, function):rest) unparsed =
> case span (/=operator) unparsed of
> (_, []) -> eval rest unparsed
> (beforeOperator, afterOperator) ->
> function
> <$> (eval operatorRegister beforeOperator)
> <*> (eval operatorRegister $ drop 1 afterOperator)
I don't know what language that is, and you haven't bothered to tell us.
(No, I'm not asking, just saying that whatever point your post might
have is defeated by not knowing what language you're using.)
Again, you've posted something that isn't relevant either to the subject
of this newsgroup (the C++ language) or to the thread (which is about
extern "C" functions throwing exceptions, with a passing reference to
the Windows calculator program).
This kind of thing is a problem. I can solve it for myself by
configuring my newsreader to stop showing me your posts. You can solve
it for everyone by not making off-topic posts. (The fact that you post
obscure things without any explanation is just icing on the unpleasant
cake.) Please don't just post whatever you think is interesting.
Consider whether it's appropriate.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-11 12:35 +0200
Re: Can extern "C" functions throw exceptions Bo Persson <bo@bo-persson.se> - 2021-09-11 13:49 +0200
Re: Can extern "C" functions throw exceptions "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-11 13:57 +0200
Re: Can extern "C" functions throw exceptions Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-11 15:19 +0300
Re: Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-11 15:32 +0200
Re: Can extern "C" functions throw exceptions HorseyWorsey@the_stables.com - 2021-09-11 15:54 +0000
Re: Can extern "C" functions throw exceptions "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-11 13:55 +0200
Re: Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-11 15:34 +0200
Re: Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-11 15:58 +0200
Re: Can extern "C" functions throw exceptions "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-11 17:00 +0200
Re: Can extern "C" functions throw exceptions "daniel...@gmail.com" <danielaparker@gmail.com> - 2021-10-06 13:36 -0700
Re: Can extern "C" functions throw exceptions Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-06 20:42 +0000
Re: Can extern "C" functions throw exceptions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-06 16:12 -0700
Re: Can extern "C" functions throw exceptions Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-06 23:22 +0000
Re: Can extern "C" functions throw exceptions Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-06 17:03 -0700
Re: Can extern "C" functions throw exceptions HorseyWorsey@the_stables.com - 2021-09-11 15:56 +0000
Re: Can extern "C" functions throw exceptions David Brown <david.brown@hesbynett.no> - 2021-09-11 20:10 +0200
Re: Can extern "C" functions throw exceptions Juha Nieminen <nospam@thanks.invalid> - 2021-09-12 09:20 +0000
Re: Can extern "C" functions throw exceptions Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-12 12:34 +0300
Re: Can extern "C" functions throw exceptions David Brown <david.brown@hesbynett.no> - 2021-09-12 12:24 +0200
Re: Can extern "C" functions throw exceptions Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-12 12:29 +0200
Re: Can extern "C" functions throw exceptions Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2021-09-12 14:44 +0100
Re: Can extern "C" functions throw exceptions James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-09-12 23:13 -0400
Re: Can extern "C" functions throw exceptions David Brown <david.brown@hesbynett.no> - 2021-09-13 09:30 +0200
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-06 13:12 -0700
Re: Can extern "C" functions throw exceptions "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2021-10-07 07:09 -0700
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-14 15:21 -0800
Re: Can extern "C" functions throw exceptions Richard Damon <Richard@Damon-Family.org> - 2021-12-14 21:17 -0500
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-16 04:21 -0800
Re: Can extern "C" functions throw exceptions "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2021-12-14 19:06 -0800
Re: Can extern "C" functions throw exceptions Ian Collins <ian-news@hotmail.com> - 2021-12-16 13:14 +1300
Re: Can extern "C" functions throw exceptions "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-12-15 18:05 -0800
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-16 04:37 -0800
Re: Can extern "C" functions throw exceptions Ian Collins <ian-news@hotmail.com> - 2021-12-17 09:39 +1300
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-16 19:24 -0800
Re: Can extern "C" functions throw exceptions Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-12-16 04:29 -0800
Re: Can extern "C" functions throw exceptions Juha Nieminen <nospam@thanks.invalid> - 2021-09-13 05:34 +0000
Re: Can extern "C" functions throw exceptions Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-13 09:55 +0300
Re: Can extern "C" functions throw exceptions Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-11 15:12 +0300
Re: Can extern "C" functions throw exceptions red floyd <no.spam.here@its.invalid> - 2021-09-13 13:21 -0700
csiph-web