« first day (1606 days earlier)      last day (2016 days later) » 

12:12 AM
did you guys see the meta post
3
A: Should a tag be used only under language-standard fitting questions?

Antti HaapalaThe (now superseded, but that's what I have in easy HTML form) C11 standard says the following (C11 4p6-7): [...] A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any strictly conforming program. and A c...

I added this one there...
apparently someone decided that using a GCC extension means that you're not allowed to tag :D
 
 
1 hour later…
1:35 AM
@AnttiHaapala a little too much pedantic for me
 
 
2 hours later…
3:25 AM
@AnttiHaapala just finish the thread, your answer is very cleaver
 
 
3 hours later…
6:05 AM
Let a struct: struct example {int a; int b;};. If a function is defined as int func() { struct example exm; return exm.a }. Should I use inline keyword or gcc will take care that.
 
7:02 AM
umm "wät"
why is a function defined like that?
you're returning an uninitialized variable
 
 
1 hour later…
8:11 AM
TUWAT?
 
8:52 AM
@AnttiHaapala That was just an example. My main question is that: the function only returns a member from a struct. See the second function in this page geoffchappell.com/studies/windows/win32/ntdll/structs/peb/…. Should I add inline before that?
 
your question still does not make any sense.
No you shouldn't. Do you know what inline means?
the foremost thing about inline is that it doesn't mean what you think it does
pretty sure you're reading some C++ cr*p, because that's what Microsoft writes about
and inline is a different thing in C
and specifically for that case that you're linking to,
it makes -2 sense.
 
I've overall idea about inline function (but not as an experienced programmer). I want to use that function multiple times. So I thought if there will be any benefit of using it as inline function. No I didn't read any C++. That's just an article.
@AnttiHaapala May you suggest me any book where I can learn it more deeply?
 
9:15 AM
12
A: What is the use of the `inline` keyword in C?

M.MNote: when I talk about .c files and .h files in this answer, I assume you have laid out your code correctly, i.e. .c files only include .h files. The distinction is that a .h file may be included in multiple translation units. static inline void f(void) {} has no practical difference with s...

 
131
Q: In C++, am I paying for what I am not eating?

SaherLet's consider the following hello world examples in C and C++: main.c #include <stdio.h> int main() { printf("Hello world\n"); return 0; } main.cpp #include <iostream> int main() { std::cout<<"Hello world"<<std::endl; return 0; } When I compile them in godbolt to assem...

 
 
3 hours later…
12:24 PM
1
Q: How to set alternate setting for the USB device using libusb

kiran BiradarI am trying to set alternate setting for the USB HUB device which has 5 interfaces. Following are the configurations for each interface. 1. Ifs= 5 Cfg#= 1 Atr=c0 MxPwr= 2mA A: FirstIf#= 0 IfCount= 1 Cls=08(stor.) Sub=06 Prot=50 A: FirstIf#= 1 IfCount= 1 Cls=03(HID ) ...

 
 
1 hour later…
1:36 PM
Why this doesn't show any error?

long* a = NULL;
long b = (unsigned long)(unsigned long long)a;
64 bit binary
 
because this is C
It isn't in style of C to prevent you from doing dumb things
 
@Biswapriyo essentially when you are explicitly casting you are saying to the compiler: I'm a big boy now, I know what I'm doing, back off!' -- and the compiler is a very understanding and obeying soul, it would do as it told.. Other than that, put the * next to the variable name and not next to the type!
 
1:53 PM
> put the * next to the variable name and not next to the type!
...meh
 
@PeterVaro That was just a typing issue. Thank you.
 
@milleniumbug In D I put it next to the type, in C I put it next to the variable name -- because they are working differently
the usual example is:
int* a, b;
this notation in C doesn't help you understand what b's type is
in D however both are pointers to int
in which case it does make sense to bound it to the type
don't you think?
 
a better language disallow multiple declaration in the same line ;)
 
oh well..
:D
 
I simply don't declare multiple variables in a single line, yes.
 
2:00 PM
@milleniumbug It sometimes helps to understand a group of variables used in same section or same purpose.
 
int* a,
     b;
@milleniumbug ..you were saying?
;)
 
@PeterVaro Clever <3
 
why thank you.. blushing
;)
 
@Biswapriyo that why struct exist
 
2:02 PM
@Stargateur Also array do exist.
@PeterVaro Found an example github.com/mintty/mintty/commit/…
 
hehehehe
(a.k.a. how to trigger both sides)
 
^exactly -- it is not solving any issue :)
I prefer to use: 1. what is used by the official documentation/standard, 2. what is considered to be the convention, 3. what is supporting the understanding most, and 4. what feels right/what I got used to -- in this specific order (i.e. if one is not fulfilled I jump to the next one)
 
hang on, I gotta do this
user image
3
 
@PeterVaro Where do you find the official docs? like all rules in c99 and/or c11?
 
@milleniumbug <3
 
2:10 PM
@milleniumbug lol
 
@Biswapriyo C doesn't have an official documentation, but it has a standard, and the latest of it is C17: open-std.org/jtc1/sc22/wg14/www/abq/…
> WARNING: It is not a light read, don't expect anything like the official Python documentation for example
 
2:25 PM
"C17 ballot", haha
 
 
5 hours later…
7:15 PM
I actually like the ability to declare a list of variables of some type T without having to repeat T each time.
I don't think it's confusing in the least.
 
 
3 hours later…
9:50 PM
@Micrified that why we are the dev and you are the scientist.
 
@Stargateur Have no fear Staragateur. One day I will present you with my new and improved C style language.
Completely untested.
 

« first day (1606 days earlier)      last day (2016 days later) »