function-declaration Questions
3
I have got the following code:
struct student_info;
void paiming1(struct student_info student[]);
struct student_info
{
int num;
char name[6];
};
The IDE gives an error
error: array type ...
Enterotomy asked 24/5, 2018 at 7:29
1
Solved
What is the difference between the two declarations in case of foo's arguments? The syntax in the second one is familiar to me and declares a pointer to function. Are both declarations fully equiva...
Olin asked 24/5, 2018 at 0:32
2
Solved
I'm trying to decipher this declaration from sqlite3.c
SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void);
It seems like it is declaring a function because subseque...
Helsie asked 15/8, 2017 at 21:2
11
Solved
This is not a lambda function question, I know that I can assign a lambda to a variable.
What's the point of allowing us to declare, but not define a function inside code?
For example:
#include ...
Spada asked 30/4, 2015 at 11:58
11
Solved
When reading through some answers to this question, I started wondering why the compiler actually does need to know about a function when it first encounters it. Wouldn't it be simple to just add a...
Sulky asked 21/1, 2011 at 10:28
2
Solved
I've asked a question here about whether taking the address of a function forces the compilation of said function specifically with regard to Substitution-Failure-Is-Not-An-Error. The most direct a...
Pl asked 18/7, 2016 at 13:8
2
Solved
From what I gather from this answer, a constexpr function's result is not a constant-expression if the function has not been declared yet. What surprises me is the following code snippet :
constex...
Johnsiejohnson asked 30/5, 2016 at 13:1
1
While producing a MCVE for this problem I stumbled upon, I've found the following discrepancy between compilers:
Consider the following code :
// constexpr int f(); // 1
constexpr int g() {
con...
Moule asked 30/5, 2016 at 13:22
2
For example,
#include <stdio.h>
void foo();
int main(void)
{
foo();
foo(42);
foo("a string", 'C', 1.0);
return 0;
}
void foo()
{
puts("foo() is called");
}
Output:
foo() is called...
Liegnitz asked 16/2, 2016 at 7:25
1
Solved
I was going through some code when I encountered this in one of the source files.
int st_insert(table, key, value)
register st_table *table;
register st_data_t key;
st_data_t value;
{
unsig...
Meeks asked 19/11, 2015 at 23:3
3
Why it is not necessary to mention first dimension of multidimensional array and necessary to mention other dimensions:
int A[][][2]={{{1,2},{3,4}},{{4,5},{5,6}}}; // error
int A[][2][2]={{{1,2},...
Millburn asked 25/10, 2015 at 9:47
1
Solved
I get this /tmp/ccnL7Yz1.o: In function 'main':
main.cpp:(.text+0x70): undefined reference to 'dng::genDungeon()'
main.cpp:(.text+0xf0): undefined reference to 'dng::clrDungeon(char**)'
collect2: e...
Rajewski asked 7/8, 2015 at 18:42
2
Solved
example function
func example(titles: [String]) `-&gt;` [UIButton] {
}
and where could i find more docs on this topic (docs relevant to functions declaring in swift)?
Caddoan asked 18/6, 2015 at 8:22
3
Solved
I came across this piece of code in C:
#include <stdio.h>
main( )
{
int i = 5;
workover(i);
printf("%d",i);
}
workover(i)
int i;
{
i = i*i;
return(i);
}
I want to know how the declara...
Wiseacre asked 30/5, 2015 at 3:59
1
Solved
If a declared function has a noexcept specificator (noexcept, noexcept(true), noexcept(false), or any other noexcept(expr) which evaluates to true or false), but it's defined in another place, do I...
Gon asked 21/4, 2015 at 15:7
2
Solved
I don't understand the meaning of typedef void interrupt_handler();. Could someone explain it with some examples?
typedef void interrupt_handler();
Burnard asked 14/12, 2014 at 23:50
2
I have a virtual C++ method that I'm defining in a .h file and implementing in a .cc file. Should the implementation in the .cc file be marked virtual, or just the declaration in the .h file? E.g.,...
Chen asked 11/9, 2014 at 21:33
3
Solved
for a typo, I leave the a in there. When I went to compile, the compiler reported:
missing a ',' between declaration of 'a' and 'f'
code:
int a
f(void)
{
}
And was very surpresing since I...
Chaiken asked 11/7, 2014 at 17:19
1
Consider an implementation of filterNot (basically the opposite of filter):
def filterNot(f, sequence):
return filter(lambda x: not f(x), sequence)
The parameter f can be a "function" or a "met...
Diocesan asked 9/5, 2014 at 18:3
5
Solved
To my surprise, I found that the name of a c++ object can be the same as class name. Can someone explain to me the reason why?
When I declare an object of class a as a a1(), it does not raise an e...
Frizzle asked 8/10, 2013 at 14:33
4
Solved
From § 8.3.5.11 of ISO/IEC 14882:2011(E):
A typedef of function type may be used to declare a function but shall not be used to define a function
The standard goes on to give this example:
typ...
Counterplot asked 25/7, 2013 at 4:25
1
Solved
6.7.6 Declarators says
Each declarator declares one identifier, and asserts that when an operand of the same
form as the declarator appears in an expression, it designates a function or object...
Toner asked 22/7, 2013 at 17:34
3
Solved
Consider the following program:
int main()
{
int exit();
((void(*)())exit)(0);
}
As you can see, exit is declared with the wrong return type, but is never called with the incorrect function ty...
Microscopy asked 11/5, 2013 at 2:4
3
Solved
In this piece of code, why f() is declared as "double & f(..."? What does it mean and how does it work? I don't even know what to google to find the answer to my question. Please help.
d...
Creath asked 27/2, 2013 at 7:48
2
Solved
In such a situation
namespace n {
void f() {
void another_function();
}
}
Should the function another_function be defined inside the namespace n or outside? VS 2012 (with the November CTP) sa...
Confession asked 3/1, 2013 at 18:31
© 2022 - 2024 — McMap. All rights reserved.