|
After trying getting into C++ multiple times before I recently started reading The Design and Evolution of C++ (1994) and I'm having great time just messing with the language. C++98 feels lot more like an extension to my beloved C instead of a horrid mess of templates and incomprehensible standardese (which I assume I'll learn to appreciate once I understand its motivations).code:
e: im the friend declaration of D 👀 ee: drunkem typos matti fucked around with this message at 19:25 on Aug 31, 2020 |
# ¿ Aug 31, 2020 17:20 |
|
|
# ¿ Apr 29, 2024 09:22 |
|
code:
SAFE_LONG_MAXIMUM and SAFE_LONG_MINIMUM are sqrt(2^31-1) and -sqrt(2^31) respectively e: Is the MSVC optimizer less aggressive in this regard? Then I could just use GNU builtin functions where needed. matti fucked around with this message at 15:56 on Sep 17, 2020 |
# ¿ Sep 17, 2020 15:45 |
|
Captain Cappy posted:Please rename the function can_be_squared_without_overflowing_a_thirty_two_bit_integer, thank you. An aggressively optimizing compiler (I'm talking of GNU) is allowed to assume that signed integers never overflow and so may optimize out conditionals that'd check for it beforehand. Now that I've had time to ponder it a bit more clearly (lol as if) I realize it's not an issue here and I'm home safe I think. thanks for letting me rubber duck a lil
|
# ¿ Sep 17, 2020 21:52 |
|
is there any ICU #define to have it only expose the C API when compiling with a C++ compiler?
|
# ¿ Jan 28, 2021 04:29 |
|
#undef __cplusplus # include <unicode/whatever.h> #define __cplusplus ah yea! thanks, works
|
# ¿ Jan 28, 2021 04:59 |
|
now onto writing a long comment block why the gently caress i need to mess with the compiler preprocessor symbols... its Temporary™ matti fucked around with this message at 05:04 on Jan 28, 2021 |
# ¿ Jan 28, 2021 05:02 |
|
yeah i woke up with a little of a hangover and dutifully decided to not do that
|
# ¿ Jan 29, 2021 00:22 |
|
Question: I'm under the impression that C++ does not allow "static const" qualified variables to be modified, but does C have that feature? Talking purely in terms of abstract machines, as defined by language standards.
|
# ¿ Sep 15, 2021 16:10 |
|
Hmmm, reading about it I think I have placed too much faith in random peoples bad interpretations of the language standard.
|
# ¿ Sep 15, 2021 16:44 |
|
Absolutely. I'm only thinking about this for documentation purposes. Got to be exact.
|
# ¿ Sep 15, 2021 17:29 |
|
-Wall -Wextra -Wno-unused
|
# ¿ Sep 17, 2021 19:08 |
|
learning the win32 api at long last (just to fix a bug in a software I want to use lol) i think everyone first project is to write a function to report system library errors, here is mine. which brings me to ask, how you do test for signed integer overflow when you use Microsoft's compiler? is there anything similar to GNU's __builtin_<op>_overflow() functions? or are you just supposed to make assumptions about widths of types and write your own in which you cast to the size next larger to test the result?
|
# ¿ Sep 29, 2021 13:14 |
|
i will take that as MSVC will not re-order my overflow checks.nielsm posted:(Or assume nobody's going to supply a message and format input exceeding 2 GB.) hmmmm matti fucked around with this message at 22:21 on Sep 29, 2021 |
# ¿ Sep 29, 2021 22:17 |
|
Foxfire_ posted:intsafe.h is the MSVC equivalent of the gcc __builting_*overflow() functions [though looking at their implementations, they're undefined behavior/using secret knowledge about how the optimizer works and just doing the same overflow checks you would do] thanks this is the knowledge i was looking for xoxo
|
# ¿ Sep 29, 2021 22:47 |
|
i ended up on the solution where i just write trivial inline assembly routines for signed integer addition when i have to do it functions have the signature <op>_<types> or <op>_<type>_<to|by>_<type> and take a jmp_buf as a third argument for handling overflow. only downside is having to declare pointers as volatile if you want to free them in the clean-up code. but it keeps any arithmetic very readable. 'unno, this is for personal stuff, i would not do this in an organization matti fucked around with this message at 17:24 on Sep 30, 2021 |
# ¿ Sep 30, 2021 17:20 |
|
too new, maybe in couple of years i do not typically expect anything to work matti fucked around with this message at 05:54 on Oct 1, 2021 |
# ¿ Oct 1, 2021 05:06 |
|
i have a question about the core guidelines, specifically ES.87 "Don’t add redundant == or != to conditions" https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-if many C style guides recommend the opposite, i.e. always use explicit comparisons unless the value is boolean. the guideline does not explain what "opportunities for mistakes" redundant comparisons have. is it just a misplaced style rule or are there realistic traps explicit comparisons have in C++?
|
# ¿ Dec 8, 2022 23:47 |
|
|
# ¿ Apr 29, 2024 09:22 |
|
giogadi posted:Some very hardcore people believe in including things in an order that doesn’t require guards. It’s insane to me but it’s a thing rob pike has a lot of clout
|
# ¿ Aug 7, 2023 17:50 |