hey :)
i have a problem. i wrote this code, a.h. a.c and the main.c:
file: a.h
#ifndef _a_H
#define _a_H
int poly (int a, int b, int c, int x);
int square (int x)
{
return x*x;
}
#endif // _a_H
file: a.c
#include "a.h"
int poly (int a, int b, int c, int x)
{
return a*square(x) + b * x +c;
}
file: main.c
#include <st...
I know that it's said when passing a variable of any integral type like int, double, long double, etc to a function; it should be done by value but I'm curious that from an assembly point(performance-wise or space-wise), wouldn't be there a situation when passing a variable of an integral type with a size bigger than pointers like long d...
For some reason i can't seem to get this right
ok i have 2 objects
class score
{
public:
int scored(int amount);
private:
int currentscore;
}
int score::scored(int amount)
{
currentscore += amount;
return 0;
}
class collisions
{
public:
int lasers();
}
// ok heres my issue
int collisions::lasers()
{
// some code h...
This is a very general programming question that I just want to put out there and see if anyone has any thoughts on it. It shows up time and time again: I have a function somefunction() which is called a lot, but the very first time its called I want it to behave just a bit differently. Here's an example:
first_time = true;
somefunction...
All,
I'm writing some performance sensitive code, including a 3d vector class that will be doing lots of cross-products. As a long-time C++ programmer, I know all about the evils of macros and the various benefits of inline functions. I've long been under the impression that inline functions should be approximately the same speed as m...
Hello, can I use this syntax under PHP 4 (default function parameter) :
function myFunction($arg1 = 'defaultValue') {}
Thanks.
...
I'm not too new to VB.Net and the syntax, but I'm not an expert. I'm working on rewriting something in VB that was previously in C# and while I was doing so, I came across a "dilemna." I can have a ReadOnly Property:
Public ReadOnly Property MaximumIndenture()
Get
Try
'If the connection is closed, open it.'
...
I have a function that needs to include a file, however this functions is used in a place from 200 to 300 times, this is obviously causing efficiency issues, is there a way to optimize this inside the function? (i know there are many ways in which i can fix this but it will cause too much impact in the whole application)
I will just put...
I am creating an application that imports several plugins. I need the ability to execute functions that are implemented in each of the plugins. For example, I need to do something like this.
/////////////////////////////////////////////////////////////////////////////////
MainApp:
[ImportMany(?)]
public IEnumerable<Lazy<?>> PluginFu...
Is it possible for you to return two values when calling a function that would output the values, for example, I have this:
<?php
function ids($uid = 0, $sid = '')
{
$uid = 1;
$sid = md5(time());
return $uid;
return $sid;
}
echo ids();
?>
Which will output 1, I want to chose what to ouput, e.g. ids($sid), but i...
is there a function in c that lets me look at the next char in an array? Also where could I find this information on my own, I tried Google and looking for existing threads on this site.
I am trying to pull numbers from a line, and store those numbers. So I want to do something like
if(c = a number and c "next character" is not a nu...
Following is the statement inside my code I am using in Matlab:
[h_sgsim,p_sgsim,ci_sgsim] = ttest(q_mean_sgsim_yearly_TankMethod,q_mean_reference_truth_yearly_TankMethod(1));
where q_mean_sgsim_yearly_TankMethod is a 100 X 1 vector and q_mean_reference_truth_yearly_TankMethod(1) is a scalar.
I don't know why its giving the error ev...
According to exec reference, calls to exec (or stack checking vararg functions in general) requires a (char*)NULL aka 0 at the end of the parameter list. GCC, however, is complaining about the following code
char cmdFullPath[4096]; //yes this 4096 thing is bad coding practice
...
execl(cmdFullPath, (char*)NULL);
//warning: not enough ...
How do you write a function for a normalized viewport using openGL
...
Because of my device I can't use virtual functions. Suppose I have:
class Base
{
void doSomething() { }
};
class Derived : public Base
{
void doSomething() { }
};
// in any place
{
Base *obj = new Derived;
obj->doSomething();
}
the obj->doSomething() will call just the Base::doSomething()
Is there a way with Base *o...
F# lets you turn operators into functions by surrounding them with ( ): for instance, (+) is of type int -> int -> int.
Is it possible to do this with the list cons operator, ::?
It doesn't behave like a normal binary operator:
FSI> (::);;
(::);;
-^^
c:\temp\stdin(3,2): error FS0010: Unexpected symbol '::' in expression.
Expecte...
I'm writing the wrong syntax, so the function is not getting called.
I'm making a jQuery function that just sends an AJAX call and redirects. But it doesn't actually apply to any selector.
my function
$.fn.update_and_return = function() {
$.ajax({type: "GET",
beforeSend: function(){
idx_var = $(".selected_adli...
How do I add some sort of call back so that I can run further code after render() has completed?
function next(){
target = max;
render();
//When render complete, do some more
//change values....
//render();
}
function prev(){
target = min;
render();
//When render complete, do some more
}
var timer;
...
I am looking for a SQL Server function to return the minimum value for datetime, namely January 1, 1753. I'd rather not hardcode that date value into my script.
Does anything like that exist? (For comparison, in C#, I could just do DateTime.MinValue)
Or would I have to write this myself?
I am using Microsoft SQL Server 2008 Express.
...
I need to create a java function that will only run for 30 minutes, and at the end of the 30 minutes it executes something. But it should also be able to self terminate before the given time if the right conditions are met. I don't want the function to be sleeping as it should be collecting data, so no sleeping threads.
Thanks
...