Search Results

Search found 559 results on 23 pages for 'preprocessor abuse'.

Page 2/23 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How do you perform macro expansion within #ifdef?

    - by Malvineous
    Hi all, I have some fairly generic code which uses preprocessor macros to add a certain prefix onto other macros. This is a much simplified example of what happens: #define MY_VAR(x) prefix_##x "prefix_" is actually defined elsewhere, so it will be different each time the file is included. It works well, but now I have some code I would like to skip if one of the tokens doesn't exist, but this doesn't work: #if defined MY_VAR(hello) What I want it to expand to is this: #ifdef prefix_hello But I can't figure out how. I need to use the MY_VAR() macro to do the expansion, so I can't just hardcode the name. (It's actually for some testing code, the same code gets included with a different prefix each time to test a bunch of classes, and I want to skip a couple of tests for a handful of the classes.) Is this possible with the C++ preprocessor?

    Read the article

  • Any other preprocessor directives in VBScript/Classic ASP?

    - by Frank
    The only pre-process directive that I know about in VBScript / Classic ASP is the #include. I don't know if that is the official name but I'm basically looking for code that can execute code or other instructions before the general VBScript. Are there any other such directives in VBScript? Such as #If or something? I'd like to be able to conditionally include or exclude a certain include file.

    Read the article

  • Visual Studio 2008 Preprocessor wierdness

    - by Canacourse
    We have set-up a simple versioning system for our builds to ensure the built files always indicate whether they are Beta Debug or Beta Release builds I moved the file version info to to myapp.rc2 and created version.h // version.h // _DEBUG is defined by VS #define _BETA #ifdef _BETA #define FILE_DESC1 _T("BETA ") #else #define FILE_DESC1 // blank on purpose #endif #ifdef _DEBUG #define FILE_DESC2 _T("Debug Version ") #else #define FILE_DESC2 _T("Release Version ") // this is greyed out in the ide when building #endif #define FILE_DESC FILE_DESC1 FILE_DESC2 // myapp.rc2 include "version.h" #ifndef _T #define _T(x) x #endif VS_VERSION_INFO VERSIONINFO FILEVERSION PROD_VER_MJR,PROD_VER_MIN,PROD_VER_UPD,JOBUILDER_BUILD PRODUCTVERSION PROD_VER_MJR,PROD_VER_MIN FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", COMPANY_NAME VALUE "FileDescription", FILE_DESC VALUE "FileVersion", JOBBUI_VERSION VALUE "InternalName", "MyApp.exe" VALUE "LegalCopyright", COPYRIGHT VALUE "OriginalFilename", "MyApp.exe" VALUE "ProductName", PRODUCT_NAME VALUE "ProductVersion", PRODUCT_VERSION VALUE "Comments", COMMENTS END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END END However when the exe is built in the debug output directory the file description always incorrectly says "BETA Release Version" instead of "BETA Debug Version" Yet the IDE indicates that "#define FILE_DESC2 _T("Debug Version ")" would be used. Why might this be? I have used these files on another project and they work correctly. Thank You...

    Read the article

  • Java Preprocessor in C#

    - by Olaseni
    Say I want to create a sort of Pre-processor for existing java code, so I can get the language specific keywords and objects, and then create routines that convert them to their Csharp equivalents, using Csharp code - what route should this take? I'm thinking of Regular Expressions, but I'm fuzzed. I have a bunch of about a 100 .java files and I need to convert them to csharp code in record time. I have manually done just about five of them and I have serious headaches already. Or are there any tools out there that already do that?

    Read the article

  • How to define a preprocessor symbol in Xcode

    - by Steph Thirion
    Is it possible to set a symbol for conditional compilation by setting up properties in an Xcode project? My aim is to to create a symbol that is available to all files, without having to use import/include, so that a set of common classes can have a special behavior in some projects. Like the following, but with my own symbols. #if TARGET_IPHONE_SIMULATOR ... #endif

    Read the article

  • Preprocessor macros: how to insert arguments?

    - by mhambra
    Hi all, the code has a number of following sections: int filter; #ifdef INPUTFILTER_FOO LOG4CXX_DEBUG(log, "FOO filter used"); filter = F_FOO; #endif They are used multiple times in the code (used to provide I/O, threading support etc for all testing configurations), Circa they are essential for debugging but make the code look harsh, want to replace them with macros, one for each category_type namespace. So, want to expand the following: MACROSTUFFBAZ(log2, stuff, "BAZ") <- the text part is unique for each class, so it needs to be included in macro too. to: #ifdef INPUTSTUFF_BAZ LOG4CXX_DEBUG(log2, "BAZ stuff used"); stuff = S_BAZ; #endif To define macros, plan to use this: debug.hpp: #ifdef INPUTSTUFF_BAZ #define MACROSTUFFBAZ ... #else #define MACROSTUFFBAZ .. no code! #endif #endif (at least this will give a clear overview of the things currently undergoing probation, without seeing them around the code)

    Read the article

  • C Preprocessor: #define in C... advice

    - by vikramtheone
    Hi Guys, I'm making a big C project and I have never come across a situation like this before so, I need your advice. What is your opinion? Is it okay to have the constants defined within conditional preprocessors like I have done below or you advise me to do this some other way? Any drawbacks if I do it this way? Regards Vikram #define NUM_OCTAVES_4 //#define NUM_OCTAVES_5 #ifdef NUM_OCTAVES_4 #define OCTAVES 4 const unsigned char borders [4] = {11, 26, 50, 98}; #elif NUM_OCTAVES_5 #define OCTAVES 5 const unsigned char borders [5] = {11, 26, 50, 98, 194}; #endif

    Read the article

  • Reliably converting C preprocessor macros to python code

    - by manual-manuel
    Hi, I have a bunch of C macros the operation of which I need to simulate in python. I saw some pointers to pygccxml or ctypeslib etc. Are these the ways to go ? Or is there something out there that is better ? The C macros if and when they change, I would like the python implementation to be auto generated rather than having to make manual modifications. Hence the question. <my_c_header.h> /* #defines type 1 */ #ifdef OS #define NUM_FLAGS (uint16_t)(3) #define NUM_BITS (uint16_t)(8) #else #define NUM_FLAGS (uint16_t)(6) #define NUM_BITS (uint16_t)(16) #endif #define MAKE_SUB_FLAGS (uint16_t)((1<<NUMFLAGS) -1) #define MAKE_TOTAL_FLAGS(x) (uint16_t)((x & MAKE_SUB_FLAGS) >> NUM_BITS) /* #defines type 2 */ #ifdef OS #DO_SOMETHING(X) os_specifc_process(x) #else #DO_SOMETHING(x) #endif /* #defines type 3 */ enum { CASE0, CASE1, CASE2 } #define MY_CASE_0 ((uint16_t)CASE0) #define MY_CASE_1 ((uint16_t)CASE1) #define MY_CASE_2 ((uint16_t)CASE2) #define /*End of file <my_c_header.h> */ Thanks M

    Read the article

  • Preprocessor not skipping asm directives

    - by demula
    I'm programming to a microprocessor (Coldfire) and I don't have access every day to the microprocessor trainer so I want to be able to execute some of my code on the computer. So I'm trying to skip a part of my code when executing on the computer by defining _TEST_. It doesn't work. It tries to compile the asm code and dies whining about not knowing the registers names (they're defined alright compiling against the Coldfire, not my Intel Core Duo). Any ideas why it's not working? or maybe an alternative way to run the code on the pc without commenting it out?. Here's sample code from my project: inline void ct_sistem_exit(int status) { #ifdef _TEST_ exit(status); #else asm volatile( "moveb #0,%%d1\n\t" "movel #0, %%d0\n\t" "trap #15\n\t" : : : "d0", "d1" ); #endif /* _TEST_ */ } If it helps: using gcc3 with cygwin on Netbeans 6.8

    Read the article

  • Preprocessor directive #ifndef for C/C++ code

    - by Leif Andersen
    In eclipse, whenever I create a new C++ class, or C header file, I get the following type of structure. Say I create header file example.h, I get this: /*Comments*/ #ifndef EXAMPLE_H_ #define EXAMPLE_H_ /* Place to put all of my definitions etc. */ #endif I think ifndef is saying that if EXAMPLE_H_ isn't defined, define it, which may be useful depending on what tool you are using to compile and link your project. However, I have two questions: Is this fairly common? I don't see it too often. And is it a good idea to use that rubric, or should you just jump right into defining your code. What is EXAMPLE_H_ exactly? Why not example.h, or just example? Is there anything special about that, or could is just be an artifact of how eclipse prefers to autobuild projects? Thank you for your help.

    Read the article

  • C++ and preprocessor macro gotcha

    - by aaa
    hello. Appologies for yet another gotcha question. Can you figure out what is wrong with the statement below? gcc error states: "type name declared as function returning array". #define MACRO(a) (a)[1] class index { typedef int index_type[2]; index_type& operator[](int i); }; int k = 0; int i = MACRO(index()[k]); ps: is such questions are deemed too annoying, I am going to stop.

    Read the article

  • [MSVC++ 2008] Using preprocessor directives to define command line options

    - by Gbps
    If I wanted to add, let's say, a new .lib to the build only if a particular #define was set, how would I do that? In the MSVC++ 2008 "Property Pages", you would simply add: Config Properties -> Linker -> Input -> Additional Dependencies, but I would like it if something like #define COMPILE_WITH_DETOURS was set, then the particular library would be added to the dependencies, otherwise it would be removed. Thanks!

    Read the article

  • C++ Preprocessor Decisions

    - by PhilCK
    Sorry I know this is basic, but perhaps it doesn't exist or I'm not googling the right words is there and a if not (is that ifndef?) an AND and an OR? so I could do something like if not DEBUG and MACOS thanks

    Read the article

  • Code Smell: Inheritance Abuse

    - by dsimcha
    It's been generally accepted in the OO community that one should "favor composition over inheritance". On the other hand, inheritance does provide both polymorphism and a straightforward, terse way of delegating everything to a base class unless explicitly overridden and is therefore extremely convenient and useful. Delegation can often (though not always) be verbose and brittle. The most obvious and IMHO surest sign of inheritance abuse is violation of the Liskov Substitution Principle. What are some other signs that inheritance is The Wrong Tool for the Job even if it seems convenient?

    Read the article

  • Code Smell: Inheritance Abuse

    - by dsimcha
    It's been generally accepted in the OO community that one should "favor composition over inheritance". On the other hand, inheritance does provide both polymorphism and a straightforward, terse way of delegating everything to a base class unless explicitly overridden and is therefore extremely convenient and useful. Delegation can often (though not always) be verbose and brittle. The most obvious and IMHO surest sign of inheritance abuse is violation of the Liskov Substitution Principle. What are some other signs that inheritance is The Wrong Tool for the Job even if it seems convenient?

    Read the article

  • Remove extra junk from C proprocessor?

    - by Brendan Long
    I'm trying to use the C proprocessor on non-C code, and it works fine except for creating lines like this at the top: # 1 "test.java" # 1 "<built-in>" # 1 "<command-line>" # 1 "test.java" The problem is that these lines aren't valid in Java. Is there any way to get the preprocessor to not write this stuff? I'd prefer not to have to run this through something else to just remove the first 4 lines every time.

    Read the article

  • Trouble with __VA_ARGS__

    - by Noah Roberts
    C++ preprocessor __VA_ARGS__ number of arguments The accepted answer there doesn't work for me. I've tried with MSVC++ 10 and g++ 3.4.5. I also crunched the example down into something smaller and started trying to get some information printed out to me in the error: template < typename T > struct print; #include <boost/mpl/vector_c.hpp> #define RSEQ_N 10,9,8,7,6,5,4,3,2,1,0 #define ARG_N(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,N,...) N #define ARG_N_(...) ARG_N(__VA_ARGS__) #define XXX 5,RSEQ_N #include <iostream> int main() { print< boost::mpl::vector_c<int, ARG_N_( XXX ) > > g; // ARG_N doesn't work either. } It appears to me that the argument for ARG_N ends up being 'XXX' instead of 5,RSEQ_N and much less 5,10,...,0. The error output of g++ more specifically says that only one argument is supplied. Having trouble believing that the answer would be proposed and then accepted when it totally fails to work, so what am I doing wrong? Why is XXX being interpreted as the argument and not being expanded? In my own messing around everything works fine until I try to pass off VA_ARGS to a macro containing some names followed by ... like so: #define WTF(X,Y,...) X , Y , __VA_ARGS__ #define WOT(...) WTF(__VA_ARGS__) WOT(52,2,5,2,2) I've tried both with and without () in the various macros that take no input.

    Read the article

  • External table and preprocessor for loading LOBs

    - by David Allan
    I was using the COLUMN TRANSFORMS syntax to load LOBs into Oracle using the Oracle external which is a handy way of doing several stuff - from loading LOBs from the filesystem to having constants as fields. In OWB you can use unbound external tables to define an external table using your own arbitrary access parameters - I blogged a while back on this for doing preprocessing before it was added into OWB 11gR2. For loading LOBs using the COLUMN TRANSFORMS syntax have a read through this post on loading CLOB, BLOB or any LOB, the files to load can be specified as a field that is a filename field, the content of this file will be the LOB data. So using the example from the linked post, you can define the columns; Then define the access parameters - if you go the unbound external table route you can can put whatever you want in here (your external table get out of jail free card); This will let you read the LOB files fromn the filesystem and use the external table in a mapping. Pushing the envelope a little further I then thought about marrying together the preprocessor with the COLUMN TRANSFORMS, this would have let me have a shell script for example as the preprocessor which listed the contents of a directory and let me read the files as LOBs via an external table. Unfortunately that doesn't quote work - there is now a bug/enhancement logged, so one day maybe. So I'm afraid my blog title was a little bit of a teaser....

    Read the article

  • LexisNexis and Oracle Join Forces to Prevent Fraud and Identity Abuse

    - by Tanu Sood
    Author: Mark Karlstrand About the Writer:Mark Karlstrand is a Senior Product Manager at Oracle focused on innovative security for enterprise web and mobile applications. Over the last sixteen years Mark has served as director in a number of tech startups before joining Oracle in 2007. Working with a team of talented architects and engineers Mark developed Oracle Adaptive Access Manager, a best of breed access security solution.The world’s top enterprise software company and the world leader in data driven solutions have teamed up to provide a new integrated security solution to prevent fraud and misuse of identities. LexisNexis Risk Solutions, a Gold level member of Oracle PartnerNetwork (OPN), today announced it has achieved Oracle Validated Integration of its Instant Authenticate product with Oracle Identity Management.Oracle provides the most complete Identity and Access Management platform. The only identity management provider to offer advanced capabilities including device fingerprinting, location intelligence, real-time risk analysis, context-aware authentication and authorization makes the Oracle offering unique in the industry. LexisNexis Risk Solutions provides the industry leading Instant Authenticate dynamic knowledge based authentication (KBA) service which offers customers a secure and cost effective means to authenticate new user or prove authentication for password resets, lockouts and such scenarios. Oracle and LexisNexis now offer an integrated solution that combines the power of the most advanced identity management platform and superior data driven user authentication to stop identity fraud in its tracks and, in turn, offer significant operational cost savings. The solution offers the ability to challenge users with dynamic knowledge based authentication based on the risk of an access request or transaction thereby offering an additional level to other authentication methods such as static challenge questions or one-time password when needed. For example, with Oracle Identity Management self-service, the forgotten password reset workflow utilizes advanced capabilities including device fingerprinting, location intelligence, risk analysis and one-time password (OTP) via short message service (SMS) to secure this sensitive flow. Even when a user has lost or misplaced his/her mobile phone and, therefore, cannot receive the SMS, the new integrated solution eliminates the need to contact the help desk. The Oracle Identity Management platform dynamically switches to use the LexisNexis Instant Authenticate service for authentication if the user is not able to authenticate via OTP. The advanced Oracle and LexisNexis integrated solution, thus, both improves user experience and saves money by avoiding unnecessary help desk calls. Oracle Identity and Access Management secures applications, Juniper SSL VPN and other web resources with a thoroughly modern layered and context-aware platform. Users don't gain access just because they happen to have a valid username and password. An enterprise utilizing the Oracle solution has the ability to predicate access based on the specific context of the current situation. The device, location, temporal data, and any number of other attributes are evaluated in real-time to determine the specific risk at that moment. If the risk is elevated a user can be challenged for additional authentication, refused access or allowed access with limited privileges. The LexisNexis Instant Authenticate dynamic KBA service plugs into the Oracle platform to provide an additional layer of security by validating a user's identity in high risk access or transactions. The large and varied pool of data the LexisNexis solution utilizes to quiz a user makes this challenge mechanism even more robust. This strong combination of Oracle and LexisNexis user authentication capabilities greatly mitigates the risk of exposing sensitive applications and services on the Internet which helps an enterprise grow their business with confidence.Resources:Press release: LexisNexis® Achieves Oracle Validated Integration with Oracle Identity Management Oracle Access Management (HTML)Oracle Adaptive Access Manager (pdf)

    Read the article

  • How to report abuse to website hosting company (GoDaddy)

    - by lgratian
    I'm not sure if this is the right place to ask such a question... Let's say that a website posted a picture of me, without my consent, and I want to be removed (it's something private, could compromise my career if it's seen by someone that shouldn't). I sent them an email asking nicely that they should remove it, but they didn't respond and the picture is still there. Using 'Whois' I found that the website is hosted by GoDaddy. Is there a way (an email address, for ex.) to report to GoDaddy that one of the sites they're hosting does something illegal and to force them to remove the photo? I searched the site and found nothing about such a thing. Thnaks in advance!

    Read the article

  • C# Preprocessor Directives

    - by MarkPearl
    Going back to my old c++ days at university where we had all our code littered with preprocessor directives - I thought it made the code ugly and could never understand why it was useful. Today though I found a use in my C# application. The scenario – I had made various security levels in my application and tied my XAML to the levels by set by static accessors in code. An example of my XAML code for a Combobox to be enabled would be as follows… <ComboBox IsEnabled="{x:Static security:Security.SecurityCanEditDebtor}" />   And then I would have a static method like this… public static bool SecurityCanEditDebtorPostalAddress { get { if (SecurityCanEditDebtorPostalAddress) { return true; } else { return false; } } } My only problem was that my XAML did not like the if statement – which meant that while my code worked during runtime, during design time in VS2010 it gave some horrible error like… NullReferenceException was thrown on “StatiucExtension”: Exception has been thrown by the target of an invocation… If however my C# method was changed to something like this… public static bool SecurityCanEditDebtorPostalAddress { get { return true; } }   My XAML viewer would be happy. But of course this would bypass my security… <Drum Roll> Welcome preprocessor directives… what I wanted was during my design experience to totally remove the “if” code so that my accessor would return true and not have any if statements, but when I release my project to the big open world, I want the code to have the is statement. With a bit of searching I found the relevant MSDN sample and my code now looks like this… public static bool SecurityCanEditDebtorPostalAddress { get { #if DEBUG return true; #else if (Settings.GetInstance().CurrentUser.SecurityCanEditDebtorPostalAddress) { return true; } else { return false; } #endif } }   Not the prettiest beast, but it works. Basically what is being said here is that during my debug mode compile my code with just the code between the #if … #else block, but what I can now do is if I want to universally switch everything to the “if else” statement, I just go to my project properties –> Build and change the “Debug” flag as illustrated in the picture below. Also note that you can define your own conditional compilation symbols, and if you even wanted to you could skip the whole properties page and define them in code using the #define & #undef directives. So while I don’t like the way the code works and would like to look more into AOP and compare it to this method, it works for now.

    Read the article

  • What does #error do?

    - by cambr
    I am guessing from # that it is only a compile-time utility. How can it be used in C/C++ programs? Did not find much about it on the internet. Any links would be helpful.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >