#include<stdio. h>
#include<stdlib .h>
#include<string .h>
#define SECONDS_PER_YEA R (60*60*24*365)U L
int main()
{
unsigned long int u_i = SECONDS_PER_YEA R;
printf("%lu\n", u_i);
return 0;
}
cc -g -c -Wall -std=c99 -DDEBUG define.c
define.c: In function 'main':
define.c:17: error: expected ',' or ';' before 'UL'
make: *** [define.o] error 1 38 2523
The qualifer must follow the digits directly.
-- www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
"DaVinci" <ap***********@ gmail.comwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
>
#include<stdio. h>
#include<stdlib .h>
#include<string .h>
#define SECONDS_PER_YEA R (60*60*24*365)U L
int main()
{
unsigned long int u_i = SECONDS_PER_YEA R;
printf("%lu\n", u_i);
return 0;
}
cc -g -c -Wall -std=c99 -DDEBUG define.c
define.c: In function 'main':
define.c:17: error: expected ',' or ';' before 'UL'
make: *** [define.o] error 1
Malcolm posted:
The qualifer must follow the digits directly.
It can be changed to simply:
#define SECONDS_PER_YEA R(60LU*60*24*36 5)
--
Frederick Gotham
"Frederick Gotham" <fg*******@SPAM .comha scritto nel messaggio
news:Vf******** ***********@new s.indigo.ie...
Malcolm posted:
The qualifer must follow the digits directly.
It can be changed to simply:
#define SECONDS_PER_YEA R(60LU*60*24*36 5)
A space is necessary
#define SECONDS_PER_YEA R (60LU*60*24*365 )
--
Giorgio Silvestri
DSP/Embedded/Real Time OS Software Engineer
On Sun, 2006-10-22 at 00:03 -0700, DaVinci wrote:
#include<stdio. h>
#include<stdlib .h>
#include<string .h>
#define SECONDS_PER_YEA R (60*60*24*365)U L
int main()
{
unsigned long int u_i = SECONDS_PER_YEA R;
printf("%lu\n", u_i);
return 0;
}
cc -g -c -Wall -std=c99 -DDEBUG define.c
define.c: In function 'main':
define.c:17: error: expected ',' or ';' before 'UL'
make: *** [define.o] error 1
You are attempting to compile a file called define.c, which has a syntax
error on line 17. If you want help, you'll have to post the code.
--
Andrew Poelstra <http://www.wpsoftware. net/projects/>
DaVinci said:
>
#include<stdio. h>
#include<stdlib .h>
#include<string .h>
#define SECONDS_PER_YEA R (60*60*24*365)U L
It doesn't work like that, I'm afraid. You can, however, do either this:
#define SECONDS_PER_YEA R 31536000UL
or this:
#define SECONDS_PER_YEA R (unsigned long)(60UL * 60UL * 24UL * 365UL)
or something along similar lines.
(Incidentally, your calculation ignores leap years.)
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Richard Heathfield posted:
#define SECONDS_PER_YEA R (unsigned long)(60UL * 60UL * 24UL * 365UL)
Something that came to mind recently...
Do you think one would be right to _always_ enclose macros in parentheses,
irrespective of the fact that it might be impossible to yield to
inappropriate parse? (What I mean by inappropriate parse is the following:
#define DOUBLE(x) (x)+(x)
int i = 5 * DOUBLE(3) * 2; /* Wups! */
As the operator precendence table currently stands (the metaphysical one,
that is :P), there's no problem with your macro above... but should we make
allowances for future additions to the language. It's not impossible that a
new operator would be added which could possibly result in an inappropriate
parse after the macro has been substituted.
Just a thought!
--
Frederick Gotham
Richard Heathfield <in*****@invali d.invalidwrites :
DaVinci said:
>#include<stdio .h> #include<stdli b.h> #include<strin g.h>
#define SECONDS_PER_YEA R (60*60*24*365)U L
It doesn't work like that, I'm afraid. You can, however, do either this:
#define SECONDS_PER_YEA R 31536000UL
or this:
#define SECONDS_PER_YEA R (unsigned long)(60UL * 60UL * 24UL * 365UL)
or something along similar lines.
(Incidentally, your calculation ignores leap years.)
You want parentheses around the second defintion:
#define SECONDS_PER_YEA R ((unsigned long)(60UL * 60UL * 24UL * 365UL)(
Consider "sizeof SECONDS_PER_YEA R".
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
"Keith Thompson" <ks***@mib.orgh a scritto nel messaggio
news:ln******** ****@nuthaus.mi b.org...
Richard Heathfield <in*****@invali d.invalidwrites :
DaVinci said:
#include<stdio. h>
#include<stdlib .h>
#include<string .h>
#define SECONDS_PER_YEA R (60*60*24*365)U L
It doesn't work like that, I'm afraid. You can, however, do either this:
#define SECONDS_PER_YEA R 31536000UL
or this:
#define SECONDS_PER_YEA R (unsigned long)(60UL * 60UL * 24UL * 365UL)
or something along similar lines.
(Incidentally, your calculation ignores leap years.)
You want parentheses around the second defintion:
#define SECONDS_PER_YEA R ((unsigned long)(60UL * 60UL * 24UL * 365UL)(
Probably:
#define SECONDS_PER_YEA R ((unsigned long)(60UL * 60UL * 24UL * 365UL))
is better :-)
>
Consider "sizeof SECONDS_PER_YEA R".
--
Giorgio Silvestri
DSP/Embedded/Real Time OS Software Engineer
Keith Thompson posted:
You want parentheses around the second defintion:
#define SECONDS_PER_YEA R ((unsigned long)(60UL * 60UL * 24UL * 365UL)(
Consider "sizeof SECONDS_PER_YEA R".
I don't understand... what could that have parsed to?
--
Frederick Gotham This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brandon J. Van Every |
last post by:
What's better about Ruby than Python? I'm sure there's something. What is
it?
This is not a troll. I'm language shopping and I want people's answers. I
don't know beans about Ruby or have any preconceived ideas about it. I have
noticed, however, that every programmer I talk to who's aware of Python is
also talking about Ruby. So it seems that Ruby has the potential to compete
with and displace Python. I'm curious on what basis it...
|
by: Martin Magnusson |
last post by:
I'm using a matrix and vector library, that won't compile. When
running g++ I get the error message "macro "minor" passed 5 arguments,
but takes just 1"
The definition of "minor" looks like below, and it takes 3 arguments.
All calls to minor that I have found in the code also pass it three
arguments, so I really don't understand this error.
Does anything look suspicious with the following definition, or must
it be that there is some...
|
by: sandwich_eater |
last post by:
I get compiler error
"cerr undeclared first use this function."
#define err_ret(e) cerr << e; return -1
....
err_ret("who ate my muffy?");
|
by: Newbie_sw2003 |
last post by:
Where should I use them?
I am giving you my understandings. Please correct me if I am wrong:
MACRO:
e.g.:#define ref-name 99
The code is substituted by the MACRO ref-name. So no overhead.
Execution is faster. Where will it be stotred?(Is it in bss/stack/?)
FUNCTION:
|
by: Louly |
last post by:
Hi everybody,
I got the code for dimming a menu item from this group after looking
for it for a long time thanks to those who share their experiences with
the others :)
The problem I'm facing is that it dims the wrong menu item!! Example,
if I write "DoCmd.SetMenuItem 0, 2, , acMenuGray", it dims the 3rd
command in the 2nd menu!! It's driving me crazy!
| |
by: raghu |
last post by:
Hello
I have a doubt plz clarify that
#ifndef SYSTEM_H
#define SYSTEM_H
what will be the value of SYATEM_H after this #define statement and
before that statement.
Thanking you all
Bye
|
by: Gestorm |
last post by:
Hi all, I found a macro "USE_VAR" in the code of bash-3.2 as
follows:
/*file: bash-3.2/shell.c*/
344 USE_VAR(argc);
345 USE_VAR(argv);
346 USE_VAR(env);
347 USE_VAR(code);
348 USE_VAR(old_errexit_flag);
349 #if defined (RESTRICTED_SHELL)
350 USE_VAR(saverst);
|
by: Tommy |
last post by:
struct stat *stats IF_LINT (= 0);
I don't know why "IF_LINT (= 0)" is needed ?
Source is df.c of df program on Linux coreutils-5.2.1\coreutils-5.2.1\src
Thanks!
|
by: Stephen Horne |
last post by:
I've been using Visual C++ 2003 for some time, and recently started
working on making my code compile in GCC and MinGW. I hit on lots of
unexpected problems which boil down to the same template issue. A
noddy mixin layer example should illustrate the issue...
class Base
{
protected:
int m_Field;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
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,...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |