« first day (3042 days earlier)      last day (1889 days later) » 
00:00 - 21:0021:00 - 23:00

9:13 PM
@traducerad it's absolutely type unsafe
all it does is dump crap in to the TU
@traducerad This doesn't actually prove them wrong
nor have I heard anyone actually make a compelling argument on that. The usual reason is that they are occasionally needed because of things you can't do yet
@traducerad They are almost never defined there, they are almost always in headers
@traducerad I can disprove most of those people with This example something I've actually seen people easily mess up that wouldn't have been an issue had they just used a template
 
user7659542
@Mgetz I haven't re-tried it, but this hopefully proves what I meant: paste.ubuntu.com/p/rqwBF9j2cH
 
user7659542
the macro MY_SUM is not typesafe, yet I am able to compile this. The other macro MY_INIT, doesn't let me compile this code
 
user7659542
@Mgetz what you expose in your header is what you want the end-user to use. Your x macro which is used to just win some lines and not make any typos has nothing to do with the endproduct and should therefor not be in the header file
 
user7659542
those shenanigans should be kept inside the source file
 
@traducerad actually the worst case with your MY_INIT is UB
which is far worse than just using a template
 
user7659542
9:24 PM
@Mgetz my init simply doesn't compile, so there isn't even any room for UB
 
@traducerad my point is that is fine in theory, but the reality is that's never what happens. Look at the boost headers... they are an unholy mess of macros to support different compilers.
 
user7659542
@Mgetz you seem to like msdn, many of the links you post in this chat are from msdn : )
 
@traducerad hahahaha no you're missing the point what if I call MY_INIT(&foo); where struct bar foo;
because that's not an array, the macro will compile just fine... but it will trigger UB by going out of bounds
@traducerad I know MS' garbage better than Linux
 
user7659542
@Mgetz Oh yhea right : )
 
@traducerad My point was that the macro can be abused and made to compile even if it's not valid
with a template you can do SFINAE to ensure you're not getting passed utter garbage
 
user7659542
9:27 PM
@Mgetz pitty you can't use this trick myfunction(int (*p)[N]){//...}
 
and with concepts I can actually provide good errors too
@traducerad well I can do better than that in C++... a la constexpr
 
user7659542
@Mgetz should have seen that coming
 
constexpr is pretty much what macros largely should be in most cases where most people abuse them for init stuff. For cases where you need code generation see Herb Sutter's metaclasses proposal
it's really cool
 
user7659542
@Mgetz another one to add to my playlist hehe
 
btw my point isn't that macros don't have their place.. it's that we should work towards tools that make them not necessary.
dumping things in the TU is rather scary
not to mention it makes debugging some compiler errors absolutely insanely painful
 
user7659542
9:33 PM
@Mgetz Is #include a macro? or just a preprocessor directive?
 
@traducerad the latter
 
user7659542
this being said it dumps stuff in your TU as well, but isn't harmfull imo
 
user7659542
but I do get your point
 
@traducerad subject to debate
There is a significant reason there is a modules proposal
and precompiled headers
 
user7659542
This being said, you earlier "stated":
 
user7659542
9:38 PM
All identifiers that begin with an underscore followed by a capital letter or by another underscore (these reserved identifiers allow the library to use numerous behind-the-scenes non-external macros and functions)
 
@traducerad copied and pasted
from cppreference, what about it?
 
user7659542
it is said that only the compiler, linker, std libs and the system on which your software runs are allowed to use variables prefixed by a double underscore
 
@traducerad for C yes
for c++ it's more complicated
but similar enough
 
user7659542
@Mgetz let s keep it simple, like this for now
 
@traducerad I'm a c++ user
 
user7659542
9:41 PM
is that in order to prevent shadowing? if you were to redefine such a variable in your code, shouldn't the compiler just tell you this variable is already defined elsewhere?
 
why would I stick to C
@traducerad it's to basically create variables that people shouldn't use so there is no chance of conflicts yes
that said people will do what they will do
 
user7659542
This means that if you were to write a device driver which is inserted in the kernel and thus part of the system on which your software runs, it is perfectly fine to prefix your variables by __
 
user7659542
although I don't immediately see what the dangers could be
 
@traducerad no, it's still a violation
 
user7659542
This guy said "system":
 
user7659542
9:44 PM
10
A: C++ implementation

Steve Jessop"C++ implementation" means the compiler plus linker plus standard libraries plus the system that the program actually runs on. Everything except your source, basically. An implementation is something that implements the C++ standard. So the book is not saying that any particular thing calls you...

 
unless you're the stdlib, compiler, or runtime you cannot declare any identifier that violates those rules if you want to be compliant
 
user7659542
So if my driver is inserted in the kernel I believe it really is part of the system
 
sigh
just because you're in kernel mode doesn't mean you can break the rules
nor does it make you part of the implementation
it makes you running in kernel mode as a device driver
The kernel can (and does) have it's own C or C++ runtime
you can in fact inspect MS's version by doing an export dump on NTDLL
 
@traducerad No, it really isn't.
if you're a device driver, the system you're running on is the kernel, so __ names are reserved for them
you're never the C++ implementation unless you're literally implementing the Standard.
 
Even then I'd say they are reserved even within the kernel for the c/C++ runtime that the kernel uses
 
9:48 PM
yes, agree
well
depends on which part of the kernel
but I guess those bits that are implementing support for the runtime are arguably part of the runtime
really it's up to them
 
@Puppy depends on the kernel, quite a few have dedicated libc subsystems that do things in very kernel flavored ways that may not fully correspond to the standard.
ex: kmalloc
 
well kmalloc may be part of a libc subsystem but it is not a Standard function, so if it isn't used in implementing a Standard function, then it's not technically part of the implementation by Standard
of course in this case it's pretty arguably if the Standard matters much
whether or not the kernel organises it into a subsystem that might happen to contain other Standard-related functions is really immaterial
 
Yeah... was just about to say that, kernels depend very heavily on implementation defined behavior for much of that anyway
 
user7659542
I now realize that companies giving laptops to their employees is actually one big trap
 
user7659542
employees take their laptop home and start working at home, for free
 
user7659542
9:58 PM
this extralegel benefit isn't that great
 
@traducerad welcome to wage theft
 
10:26 PM
Went to this talk about cyber security, the most useful thing I got out of the first half was that I partially cleaned up my spam email account. It's only the last 20 minutes I got something useful out of the talk. Thank god I brought my macbook!
 
If you want to break even, "loose" your laptop every few weeks
 
user7659542
@Mikhail hahaha, I ll try that!
 
user7659542
I ll try to loose the pentium 4 with windows xp they gave me every few weeks
 
Careful, this chat can be used against you in a court of law. Thats why legal purposes I've assumed somebody else's name.
 
Also get to talk to a girl who is working in the A.I. field, who confirmed my suspicion that you almost never get enough data to get the accuracy you desire at the present when it comes to A.I. training.
 
user7659542
10:32 PM
@Mikhail I was kidding!
 
user7659542
They gave me a pentium 2
 
That's twice the pentium
 
I need to accept help more ...
 
00:00 - 21:0021:00 - 23:00

« first day (3042 days earlier)      last day (1889 days later) »