473,804 Members | 3,790 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with using _attribute_ ((unused))

66 New Member
I am trying to learn how to use the attribute unused so I created a little test program. Can you please tell me what is wrong? I get syntax errors "before attribute" and "before (" (sometimes).

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2.  
  3. #define UNUSED _attribute_ ((unused))
  4.  
  5. void testUnused(int a UNUSED, int b);
  6.  
  7. int main()
  8. {
  9.   //testUnused(2, 5);  //i tried commenting this out, but still get syntax error
  10.   printf("hello\n");
  11. }
  12.  
  13. void testUnused(int a UNUSED, int b)
  14. {
  15.   printf("%d", b);
  16. }
  17.  
thanks!
Aug 7 '08 #1
1 4050
weaknessforcats
9,208 Recognized Expert Moderator Expert
Often a little Google goes a long way.

Read this and then look at your code: http://www.unixwiz.net/techtips/gnu-c-attributes.html.
Aug 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1865
by: Bernard Davest | last post by:
Does anybody know a tool that could help me finding unused functions on my VB applications? Thanks for your help. Bernard Davest
0
1542
by: Donal | last post by:
I have the following: <xsl:variable name="position"><xsl:value-of select="position()"/></xsl:variable> <xsl:attribute name='style'><xsl:value-of select="//ExportData/Definition/Column/Style"/></xsl:attribute> However, //ExportData/Definition/Column/Style always seem to return //ExportData/Definition/Column/Style.
6
15231
by: marktm | last post by:
Hi- I am trying to use setInterval to call a method within an object and have not had any luck. I get "Object doesn't support this property or method" when I execute the following code. What I am doing wrong? Your help will be much appreciated. Thanks
5
5103
by: Woon Kiat | last post by:
Hi, Using IDL, I can declare my enumeration like following, library MyAppLib { importlib("stdole32.tlb"); importlib("stdole2.tlb"); typedef enum MyColor
4
1150
by: jsever05 | last post by:
I have created a class that communicates with an external program using a single socket connection. This socket connection is already thread-safe, so multiple requests to the socket can be made at the same time. I am trying to set this up as a global object in an ASP.NET web server running IIS 5.0, but I'm having a problem with that. In the Global.asax.cs file, I have added the following reference:
4
1063
by: Bob | last post by:
If two attribute instances of the same type have all their fields values identical, the compiler will say that they are not equal to each other, yet adding them both as keys in a hashtable will throw an exception. Is this expected behavior or a bug? I've included an example below. Run the code as is and no exception is thrown. Run it with both attributes contructed identically, or remove all fields in the TestAttribute class, and an...
1
1111
by: Phenglai | last post by:
I need a little help getting an attribute added to my XML Doc. I am trying to interface with the FedEx web site and they have this in the root: <FDXTrackResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FDXTrackRequest.xsd"> How do I get the noNamespaceSchemLocation in there? I have tried this: (This is in the class of the XMLRoot)
1
2374
by: Filip Hendrickx | last post by:
Hi there. I want to generate elements, choosing the element name dynamically. So I tried to use attribute value templates: <xsl:element name="{$local-name($someNode)}"> <!-- Generate element content. --> </xsl:element> where $someNode is an XML tree.
3
3870
by: binary_sunset | last post by:
Okay... so this may be all to obvious to all except myself, but I am having some difficulty with XML output from Adobe InDesign. Each separate article in my publication is tagged as an article, with a component tree, but the articles all appear in the XML output as child nodes of the previous article ala: <article> <title/> <date/> <body/>
0
10568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10311
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.