Hi guys,
I have defined a variable in a separate config file:
define('URL', 'someurl.co.uk');
However, when I try to use it to concat with a string inside a class:
class AdminEmail extends Email {
private $from = "jsmith".URL;
I get the following error:
Parse error: parse error, expecting `','' or `';''
But if I echo it ou...
Hey all; This question more falls into the category of best practices, and clean/safe code for distribution.
I'm working on a math library in c++, for my portfolio, and to use during my last two semesters of College. I want this library to be very easy to use, and to minimize the possibilities of conflicts with pre existing code.
For...
I have an old osCommerce site that was PHP4, now running on PHP5. Named constants defined with define() are being evaluated incorrectly:
$string = '<a href="http://www.oscommerce.com" target="_blank">' . BOX_ENTRY_SUPPORT_SITE . '</a><br>';
will show as BOX_ENTRY_SUPPORT_SITE, not the value placeed in BOX_ENTRY_SUPPORT_SITE.
Somethi...
I'm a bit new to C++, so bear with me. I'm trying to figure out where exactly to place my #defines and #includes in my project. I have something like this:
main.h
#include "other.h"
#define MAX_GROUPS 100
struct Cat
{
int something[MAX_GROUPS];
}
In other.h I also need to use MAX_GROUPS, so do I also define MAX_GROUPS in other....
Imagine I have this constant in PHP:
define('APP_PATH', str_replace('//', '/', str_replace('\\', '/', dirname(__FILE__) . '/')));
When I use APP_PATH in my application, does PHP execute the code (dirname, and the two str_replace on __FILE__) each time or PHP execute the code once and store the result in APP_PATH ? I hope I'm clear eno...
Hi, everyone,
I want to ask a question about the objective C or may be the C language. I want to ask what is the meaning of the following code of #define? Is it like to declare a variable? Thank you.
#define kMountainNameString @"name"
#define kMountainHeightString @"height"
#define kMountainClimbedDateString @"c...
How does the following code work?
#define ENABLE_DEBUG 1
#if ENABLE_DEBUG
#define LOG_MSG printf
#else
#define LOG_MSG(...)
#endif
...
Say you have a C project with tons of files, and tons of configurations managed by usign the -D option in GCC to define some flags.
In my particular case, I have loads of files with that kind of stuff:
void foo( sometype *x)
{
do_stuff_with_x(x);
#ifdef MY_FLAG
do_additional_stuff(x);
#endif
#ifdef OTHER_FLAG
do_some_other_s...
I've tried defining EXTJSON_SBJSON by setting my project's Other C Flags:
-DEXTJSON_SBJSON
It doesn't work: TTURLJSONResponse still uses YAJL.
...
I need to provide configuration file, which will describe which STL header files to include. I have found that usually it is done by defining a lot of HAVE_XXX_HEADER macros. I wonder if there's something wrong with explicitly providing header name in a macro. Then instead of testing each variant:
#if defined(HAVE_TR1_UNORDERED_MAP_HEAD...
I've heard these terms thrown around describing languages before. like C is not quite a low level language, C++ is a mid level, and Python is a High level language. I understand that it has to do something with the way the code is compiled, and how it is written. But what I want to know is what defines a language into one of those 3 cate...
I am trying to assign a variable to a class in PHP, however I am not getting any results?
Can anyone offer any assistance? The code is provided below. I am trying to echo the URL as shown below, by first assigning it to a class variable.
class PageClass {
var $absolute_path = NULL;
function get_absolute_path(){
$url = $...
How to undefine a variable in Scheme? Is this possible?
...
I've been trying my hand at OO PHP, and currently have three files. I have a class_lib.php which, at the moment, just has a databaseServer class, an index.php file and a definitions.php file. I want to put all my sensitive database info into the definitions file. However, when I do, I get an error when trying to connect to the database: ...
I am trying to understand a c++ code that reads a dll explicitly.
Does any one know how the line "#define LFE_API(name) LFE_##name name" bellow actually works?
I understand "#define LFE_API(name) LFE_##name" but get confused about the last "name".
struct Interface
{
# ifdef LFE_API
# error You can't define LFE_API be...
A hypothetical question: Is it possible to have a C++ program, which includes preprocessor directives, entirely on one line.
Such a line would look like this:
#define foo #ifdef foo #define bar #endif
What are the semantics of such a line?
Further, are there any combinations of directives which are impossible to construct on one li...
Hi people
I'm doing a translation of php script and want to gain some time by doing some automatization
The file contains very large number of lines like these
define('LNG_NewsletterNameIsNotValid', 'Email Campaign name is not Valid');
define('LNG_UnableToCreateNewsletter', 'Unable to create an Campaña de Email');
define('LNG_HLP_Newsle...
I'm reading the phoneME's source code. It's a FOSS JavaME implementation. It's written in C++, and I stumbled upon this:
// Makes a string of the argument (which is not macro-expanded)
#define STR(a) #a
I know C and C++, but I never read something like this. What does the # in #a do?
Also, in the same file, there's:
// Makes a strin...
I've found some weird C++ preprocessor clauses, like:
#define COMPILER_FLOAT_ENTRIES_DO(template)
and
#define COMPILER_FLOAT_ENTRIES_DO(template) \
template(jvm_fadd) \
template(jvm_fsub) \
template(jvm_f2d)
What does passing "template" reserved word to a #define, and calling template(something) mean? I couldn't find any...
As the title says; what's the difference in practice between the inline keyword and the #define preprocessor directive?
...