function-calls

Executing bound std::function throws std::bad_function_call

牧云@^-^@ 提交于 2019-12-13 09:01:20
问题 I want to bind a member function to a std::function<void(void)> . I heard that member functions take one extra parameter which is the instance pointer. Therefore I call std::bind(&Class::Function, this, parameter) but when I execute the function object, it throws a runtime error. Unhandled exception at at 0x748D4B32 in Application.exe: Microsoft C++ exception: std::bad_function_call at memory location 0x0114F4E8. The parameter is a pointer to one of my own struct s. How am I doing wrong? What

Categorizing architectures based on calling features

与世无争的帅哥 提交于 2019-12-13 02:55:30
问题 There are different ways of calling functions: call stacks, continuation passing, messaging and event handling. What do you call the category of these features? Invocation? What do you call architectures categorized by these features? Invocation architecture? Sub question: Other than the four given, what are some examples of this type of feature? 回答1: What you're asking for sort of generalizes the idea of calling conventions , so you might be able to get away with using that in an expanded

Can JavaScript call a PHP function directly, or do I need separate php file to call the function?

穿精又带淫゛_ 提交于 2019-12-12 10:00:54
问题 I am doing some basic Ajax stuff (not jquery.. just learning the basics), and I have a general structure set up where html calls a javascript function which sends data to and runs a specific php page. But what if I just need to run a php function that's already defined in functions.php. Is that possible at all? I'm getting tired of making new php files for every task ;) 回答1: You could define a class in php to handle stuff like this, such as: functions.php: class MyFunctions { function foo() {

NDIS filter driver' FilterReceiveNetBufferLists handler isn't called

大憨熊 提交于 2019-12-12 07:14:29
问题 I am developing an NDIS filter driver, and I fount its FilterReceiveNetBufferLists is never called (the network is blocked) under certain condition (like open Wireshark or click the "Interface List" button of it). But When I start the capturing, the FilterReceiveNetBufferLists get to be normal (network restored), this is so strange. I found that when I mannually return NDIS_STATUS_FAILURE for the NdisFOidRequest function in an OID originating place of WinPcap driver (BIOCQUERYOID & BIOCSETOID

No matching function call to template function

半世苍凉 提交于 2019-12-12 04:54:28
问题 A template function I have written has the following signature: template<class IteratorT> auto average(IteratorT& begin, IteratorT& end) -> decltype(*begin) I thought that this would work fine, but apparently it doesn't. I call the function by passing in pointers to the beginning and end of an array: int integers[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; auto average = sigma::average(&integers[0], &integers[8]); But clang tells me that it cannot find a matching function: error: no matching function

Calling the function twice vs. storing the output and using it in Java

偶尔善良 提交于 2019-12-12 01:36:26
问题 Suppose that I have a boolean function isCorrect(Set<Integer>) . The parameter of the function is calculated by another function buildSet() . Which one is better in terms of both time and space efficiency? Set<Integer> set = buildSet(); if(isCorrect(set)) doSomethingWith(set); or if(isCorrect(buildSet())) doSomethingWith(buildSet()); 回答1: The first approach is better, and I don't think this is a matter of opinion. Don't call the same function twice wastefully when you already have its result.

Structure parameter corrupted on function call

删除回忆录丶 提交于 2019-12-11 17:59:14
问题 I'm having trouble tracking down the cause of strange behavior in passing a structure as a parameter. The structure in question, structFoo, has the following declaration: typedef struct _structFoo { int id; BSTR szDescription; VARIANT vData; BOOL bTransient; } structFoo; I have two modules, A and B. Module A calls B::foo( int id, uint filter, structFoo sF ). In A, before the call, the structFoo structure is properly formed and filled with valid data. However, once the function call to B::foo(

Calling a C function in assembly [duplicate]

徘徊边缘 提交于 2019-12-11 12:39:28
问题 This question already has answers here : Calling C functions from x86 assembly language (2 answers) Closed 5 years ago . Despite I searched everywhere I couldn't find any solution to my problem.The problem is that I I defined a function "hello_world() " in a C file "hello.c" and I want to call this function in an assembly file . "hello_assembly.asm" .Can anyone help me ? Thank you. 回答1: You could check the below example which might give some idea. \#include <stdio.h> int main(void) { signed

How to parse JavaScript function expression calls with ANTLR?

大城市里の小女人 提交于 2019-12-11 10:35:37
问题 I am building a JavaScript instrumentor with ANTLR, using the Patrick Hulsmeijer EcmaScript 3 grammar. I'm having a problem parsing this line of code: function(){}(); that is a direct call of a function expression. The parser recognizes the statement as a function declaration and then fails when it finds the parentheses after the function body. The reason is that function declarations are recognized with most precedence to avoid the ambiguity with function expressions. This is how the grammar

Bash script for extracting function calls from c files

我与影子孤独终老i 提交于 2019-12-11 09:44:33
问题 I'm new to scripting, and I'm attempting to extract all function calls from a c files, all present in a directory. Here is my code so far, but it seems to be giving no output. #!/bin/bash awk '/[ \t]*[a-zA-Z_]*\(([a-zA-Z_]*[ \t]*,?)*\);/ {print $0}' *.c I'm stumped. Also the c files all have at least one function call. 回答1: You should debug your regexp. Reduce it until you get some matches, then add again the other parts, checking if you get the expected results. 来源: https://stackoverflow.com