Go to Post Drive fast...drive true...otherwise it will kind of crush you - techhelpbb [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2007, 13:27
Eclipse's Avatar
Eclipse Eclipse is offline
Registered User
AKA: Sensei Hanzo
FRC #1250 (Gatro-Bots)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Dearborn, MI
Posts: 18
Eclipse is an unknown quantity at this point
Pragma

So, I've seen the pre-processor command #pragma in several files and have heard people talking about it, but I haven't a clue what it does. Can anyone explain this to me? o_ô
__________________
xXx.S3nS31-h4nz0.xXx
  #2   Spotlight this post!  
Unread 10-02-2007, 16:58
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Pragma

Try reading this.

Is your question answered?
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #3   Spotlight this post!  
Unread 11-02-2007, 02:16
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,588
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Pragma

#PRAGMA is a compiler directive. It is a way to pass information to the compiler that is not standard ANSI C. Because of that, there isn't any standard. One compiler may have a #PRAGMA command that doesn't work with any other compiler.

The post the Mike linked to is one example of a #PRAGMA for the C18 compiler. Another example is in this thread: http://www.chiefdelphi.com/forums/sh...ad.php?t=51550 Another example, for one project using Borland C, I used #PRAGMA pack to tell the compiler to byte align a particular structure, instead of word aligning it like default. If I were to try to move that code to another compiler, I would have to find out how to byte align structures with that compiler.

You can find a full listing of all the #PRAGMA directives that the C18 compiler supports in the MPLAB C18 C Compiler User's Manual here: http://kevin.org/frc/C18_users_guide.pdf

You can do a lot of neat things with #PRAGMA, but it's also one of the easiest ways to write non-portable code (not a big deal for our use, but it is in industry).

Last edited by Joe Ross : 11-02-2007 at 02:20.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ADC #pragma cprogrammer Programming 1 26-10-2006 20:42


All times are GMT -5. The time now is 00:30.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi