Skip to Content.
Sympa Menu

freetds - RE: [freetds] A new patch - various fixes

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] A new patch - various fixes
  • Date: Wed, 19 Mar 2003 13:34:24 -0500

> From: Thompson, Bill D (London) [mailto:ThompBil AT exchange.uk.ml.com]
> Sent: March 19, 2003 12:39 PM
>
> " the expressions in the initializer for an auto or register
> object or array
> must likewise be constant expressions if the initializer is a
> brace enclosed list"
>
> So I guess if clause_buffer is automatic, its address is not
> regarded as a constant expression....

Hmm. Am I then to understand that this is OK:

char buf[8], *s = buf;

but not

char buf[8], *s[] = {buf, buf};

because buf is not a constant expression and lies within a brace-enclosed
list? I guess so. I don't think the fact that the pointer is part of a
structure restricts its initialization rules.

Looking at the definition of "constant expression" in the appendix, I can
see that the address of an automatic isn't known at compile time; of course
it's an offset of the value of the frame pointer.

I cannot get gcc to generate even a warning for this.

--jkl

> > From: Lowden, James K [SMTP:LowdenJK AT bernstein.com]
> > Sent: 19 March 2003 16:46
> > To: 'FreeTDS Development Group'
> > Subject: RE: [freetds] A new patch - various fixes
> >
> > > From: Thompson, Bill D (London)
> [mailto:ThompBil AT exchange.uk.ml.com]
> > > Sent: March 19, 2003 9:42 AM
> > >
> > > Also changed initialisation of
> > > a structure in bcp.c - my compiler (Sun workshop cc 4.2)
> objected...
> >
> > Lemme get this straight. Your compiler complained about:
> >
> > TDS_PBCB colclause = { clause_buffer, sizeof(clause_buffer) };
> >
> > even though both values are known at compile time (never
> mind that it's an
> > ANSI standard construction)? I find this hard to believe,
> not because I
> > don't trust you, but because I've been initializing
> structures that way
> > since before Bill Gates dropped out of Harvard. It's explained and
> > illustrated in section 6.3 of "The C Programming Language",
> copyright
> > 1988.
> >
> >
> > Does this work:
> >
> > enum {CLAUSE_BUFFER_SIZE = 4096};
> > char clause_buffer[CLAUSE_BUFFER_SIZE] = {0};
> > TDS_PBCB colclause = { clause_buffer, CLAUSE_BUFFER_SIZE };
> >
> > Does this:
> >
> > #define CLAUSE_BUFFER_SIZE 4096
> > char clause_buffer[CLAUSE_BUFFER_SIZE] = {0};
> > TDS_PBCB colclause = { clause_buffer, CLAUSE_BUFFER_SIZE };
> >
> > Section 2.4 of the same book, wherein initialization of variables is
> > described, says initialization of automatic variables may
> be done with
> > "any
> > expression". I think someone should mention this to Sun?
> I could send
> > them
> > a copy.
> >
> > --jkl
> >
> >
> > The information contained in this transmission may contain
> privileged and
> > confidential information and is intended only for the use
> of the person(s)
> > named above. If you are not the intended recipient, or an
> employee or
> > agent
> > responsible for delivering this message to the intended
> recipient, any
> > review, dissemination, distribution or duplication of this
> communication
> > is
> > strictly prohibited. If you are not the intended recipient,
> please contact
> > the sender immediately by reply e-mail and destroy all copies of the
> > original message. Please note that we do not accept account
> orders and/or
> > instructions by e-mail, and therefore will not be
> responsible for carrying
> > out such orders and/or instructions.
> >
> >
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS AT lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.





Archive powered by MHonArc 2.6.24.

Top of Page