Hello
This is a VB.Net newbie question. I'm confused at the different ways to declare and define variables.
Here's an example:
Dim URL As String = http://www.c-sharpcorner.com/default.asp
Dim request As HttpWebRequest = WebRequest.Create(URL)
Dim response As HttpWebResponse = request.GetResponse()
Dim reader As StreamReader = New Stre...
I get this error:
Traceback (most recent call last):
File "D:/Python26/PYTHON-PROGRAMME/049 bam", line 9, in <module>
ball[i][j]=sphere()
NameError: name 'ball' is not defined
when I run this code. But the ball is defined ( ball[i][j]=sphere() ). Isn`t it?
#2D-wave
#VPython
from visual import *
#ball array #ready
for i in ran...
In C, shall I prefer constants over defines? I've reading a lot of code lately, and all of the examples make heavy use of defines.
...
In our application (older parts) we alter calls to malloc (and realloc) and free so our own implementations are called instead of the standard runtime ones, e.g.
#define malloc(s) OurMalloc(s)
#define free(p) OurFree(p)
This works quite good (for newer C++ code we simply implement global new and delete operators, so the C++ solution...
i have to do something like this in C but it works only if I use a char but I need a string
how can I do?
#define USER "jack" // jack or queen
#if USER == "jack"
#define USER_VS "queen"
#elif USER == "queen"
#define USER_VS "jack"
#endif
thanks to all!
...
Hi,
I'm developing a little C# application for the fun. I love this language but something disturb me ...
Is there any way to do a #define (C mode) or a symbol (ruby mode).
The ruby symbol is quite useful. It's just some name preceded by a ":" (example ":guy") every symbol is unique and can be use any where in the code.
In my case i'...
I want to make a simple macro with #define for returning the smaller of two numbers.
How can i do this in C ? Suggest some ideas, and see if you can make it more obfuscated too.
...
Hello
I am importing Tables from a Oracle DataBase, using a VB.NET dataAdapter. I use the "fill" comand to add the imported data to a DataSet. How is it possible to define a specific column of a DataTable as PrimaryKey, after the DataTable is already filled with data?
Thank your for your help.
...
I cant figure out where core animation on iPhone OS 3.1.2 is defined.
Anybody know?
...
#include <stdio.h>
#define UNITS {'*', '#', '%', '!', '+', '$', '=', '-'}
#define PrintDigit(c, d) (for (i=0; i < c ; i++)putchar(unit[d]);)
char unit[] = UNITS;
//void PrintDigit(c, element) {
// int i;
// for (i=0; i < c ; i++)
// putchar(unit[element]);
//}
int main( ) {
int i, element=4;
PrintDigit(10, element);
...
Hi All,
in a pre-compiled header if I do:
#define DS_BUILD
#define PGE_BUILD
#define DEMO
then in source I do:
#if (DS_BUILD && DEMO)
---- code---
#elif (PGE_BUILD && DEMO)
--- code---
#else
--- code ---
#endif
Do I get an error that states: error: operator '&&' has no right operand
I have never seen this before. I am...
Hi, I want to see how my #include files be processed when Microsoft Visual Studio C++ compile it.
As I remember, there is a compile option to inline all #includes and #define lines but I can't find it.
I use MSVC 2005 sp1. Thanks.
...
Hi, I've read that static variables are used inside function when one doesn't want the variable value to change/initialize each time the function is called. But what about defining a variable static in the main program before "main" e.g.
#include <stdio.h>
static double m = 30000;
int main(void)
{
value = m * 2 + 3;
}
Here the varia...
Here's a strange one relating to a combination of the 'define' and 'include' functionality that the CC.NET preprocessor exposes. We're running CCNet 1.4.4.83, and our ccnet.config file is structured and split to make best use of common element blocks stored in subfiles that are included by the main config file; we also split out the core...
Say I have a constant:
#define PI 3.14
Say I have a static library with multiple header and source files. If I declare this in the header file, will its scope apply to all of the source files? Or do the source files need to include the header with the declaration of PI?
...
Suppose I have a list of #defines in a header file for an external library. These #defines represent error codes returned from functions. I want to write a conversion function that can take as an input an error code and return as an output a string literal representing the actual #define name.
As an example, if I have
#define NO_ERROR ...
I have a lot of #define's in my code. Now a weird problem has crept up.
I have this:
#define _ImmSign 010100
(I'm trying to simulate a binary number)
Obviously, I expect the number to become 10100. But when I use the number it has changed into 4160.
What is happening here? And how do I stop it?
ADDITIONAL
Okay, so this is due ...
Is it possible to put a macro in a macro in c++?
Something like:
#define Something\
#ifdef SomethingElse\ //do stuff \
#endif\
I tried and it didn't work so my guess is it doesn't work, unless there's some sort of syntax that can fix it?
...
According to the PHP docs, one can initialize properties in classes with the following restriction:
"This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated."
I'm trying...
Whlie reading codes of my group project, I come across many DEFINEs, and some of them seems strange. To generalize it, please look at the following 2 examples.
Example 1:
#define SNPRINTF(dst, fmt, arg...) snprintf(dst, sizeof(dst), fmt, ##arg)
what does "##" means in this circumstance? I've tried to delete both of them, and wri...