function-call

How Windows thread stack guard page mechanism works in case of uninitialized local variables?

≯℡__Kan透↙ 提交于 2020-02-27 07:51:35
问题 On Windows OS for x86-32/x86-64 architecture thread stack virtual memory consist of "Reserved Part" "Commit Part", "Guard Page" and "Reserved Page". Question: Imagine that I have 1 page of commit memory, and 1MB of reserve memory for thread stack. I allocate on the stack some memory equal to K Pages without initialization. K is equal for example 10. It seems that in start of stack frame memory on the stack will be allocated by user space code like this: sub esp, K*4096 Guard Page mechanism

error: no matching function for call to ‘std::vector<std::vector<int>>::push_back(std::vector<std::__cxx11::basic_string<char> >&)’

二次信任 提交于 2020-01-16 16:20:11
问题 I am trying to debug this code from my supervisor and I'm new to C++. I found a few similar no matching function for call to questions, which gave me ideas what the problem might be but was not able to solve it. I have listed my thoughts below the error message and relevant function. Error message: In function ‘int main(int, char**)’: distanceMatrixToSageGraph.c:104:43: error: no matching function for call to ‘std::vector<std::vector<int>>::push_back(std::vector<std::__cxx11::basic_string

Warning messages for all of my functions using pointers. Expected 'int*' but argument is of type 'int (*)[10]'

大城市里の小女人 提交于 2020-01-11 14:16:29
问题 The code works fine I'm just worried about the warning messages I'm getting, would there be a way to make them not appear? Is there any reason to be worried about them? Also farther down in the code I don't quite understand what I did or why it worked. It wasn't working before so I looked up what other people did with pointers and it works now Warning passing argument 1 of 'readarray' from incompatible pointer type [-wincomp readarray(&a); ^ note: expected 'int*' but argument is of type 'int(

Warning messages for all of my functions using pointers. Expected 'int*' but argument is of type 'int (*)[10]'

偶尔善良 提交于 2020-01-11 14:15:09
问题 The code works fine I'm just worried about the warning messages I'm getting, would there be a way to make them not appear? Is there any reason to be worried about them? Also farther down in the code I don't quite understand what I did or why it worked. It wasn't working before so I looked up what other people did with pointers and it works now Warning passing argument 1 of 'readarray' from incompatible pointer type [-wincomp readarray(&a); ^ note: expected 'int*' but argument is of type 'int(

Why is a Common-Lisp Lambda expression a valid function name?

梦想的初衷 提交于 2020-01-06 07:30:22
问题 So let's say I want to call some function. If I've defined the function with a defun, I just use the name of the function at the beginning of a list followed by it's arguments like so (I will be using "=>" in examples to show the output of entering the code into the CLisp REPL): (defun f (a) (lambda (b) (+ a b))) => F (f 12) => #<FUNCTION :LAMBDA (B) (+ A B)> Simple enough. The first element of the list must be the name of a function, special operator, or macro. Except, the following is also

Template function gives “no matching function for call” error

旧城冷巷雨未停 提交于 2020-01-06 04:37:05
问题 First question on stackoverflow :) I'm relatively new to C++, and have never used templates, so forgive me if I'm doing something silly. I have a template function that combs through a list and checks for a specified element of a general type. That way I can specify whether it's looking for a string, or an int, or whatever. template <class T> bool inList(T match, std::string list) { int listlen = sizeof(list); for (int i = 0; i <= listlen; i++) { if (list[i] == match) return true; else

Howto pass a function to a function in Python?

让人想犯罪 __ 提交于 2020-01-04 09:39:23
问题 I am a beginner/intermediate in Python. I have coded a 4th-order Runge-Kutta method (RK4) into Python. It is basically solving a pendulum, but that is not the point here. I want to improve the RK4 method in the following way: I want to be able to pass the function f directly to the RK4 function, i.e. RK4(y_0, n, h) should become RK4(f,y_0,n,h). This would have the great advantage that I could use RK4 for other f functions that describe other systems, not just this one pendulum. I have played

Howto pass a function to a function in Python?

半腔热情 提交于 2020-01-04 09:39:12
问题 I am a beginner/intermediate in Python. I have coded a 4th-order Runge-Kutta method (RK4) into Python. It is basically solving a pendulum, but that is not the point here. I want to improve the RK4 method in the following way: I want to be able to pass the function f directly to the RK4 function, i.e. RK4(y_0, n, h) should become RK4(f,y_0,n,h). This would have the great advantage that I could use RK4 for other f functions that describe other systems, not just this one pendulum. I have played

How I can make a string array interchange it's components with a swap function?

别来无恙 提交于 2020-01-04 04:43:07
问题 The problem is that this code won't interchange these 2 strings. I'm new to programming but I can tell that the problem is that swap function, but I do not know how to fix it. I tried to add strcpy instead of "=" in swap but that didn't worked. #include <stdio.h> #include <stdlib.h> void swap(char *t1, char *t2) { char *t; t=t1; t1=t2; t2=t; } int main() { char *s[2] = {"Hello", "World"}; swap(s[0], s[1]); printf("%s\n%s", s[0], s[1]); return 0; } 回答1: You want to use out parameters here, and

How to call a PHP function in JavaScript?

空扰寡人 提交于 2019-12-28 13:21:09
问题 I have index.php <select id="year_list" name="year_list" onchange="check_year_event('year_list', 'event_list');" > . . . </select> <select id="event_list" name="event_list" onchange="check_year_event('year_list', 'event_list');" > . . . </select> . . . <?php function checkYearandEvent($year, $event) { $year_event = mysql_query("SELECT * FROM year_event WHERE year = '$event' AND event = '$event'") if (mysql_num_rows($year_event) > 0) { // do this } } ?> myscripts.js function check_year_event