Skip to contentSkip to conversation

(trivial 2.5.74) compilation fix drivers/mtd/mtd_blkdevs.c

PATCH In review [email protected] 3 participants 4 messages Jul 3, 2003 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (trivial 2.5.74) compilation fix drivers/mtd/mtd_blkdevs.c

C does not let us declar variables in the middle of a block (yet).

drivers/mtd/mtd_blkdevs.c +2 -1
@@ -211,9 +211,10 @@
 	case HDIO_GETGEO:
 		if (tr->getgeo) {
 			struct hd_geometry g;
+			int ret;
 
 			memset(&g, 0, sizeof(g));
-			int ret = tr->getgeo(dev, &g);
+			ret = tr->getgeo(dev, &g);
 			if (ret)
 				return ret;
 
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"junkio" == junkio <[email protected]> writes:

junkio> C does not let us declar variables in the middle of a block (yet).

It depends what do you call C :)

C99 does.

Later, Juan.

Signature · 2 lines
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy
#2 lore raw
Quoted 7 lines · Juan Quintela
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"junkio" == junkio <[email protected]> writes:

junkio> C does not let us declar variables in the middle of a block (yet).

It depends what do you call C :)

C99 does.

Unfortunately gcc 2.95.x does not allow it, so we shouldn't be using it in the kernel (yet).

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#3 lore raw
In reply to Juan Quintela
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"JQ" == Juan Quintela <[email protected]> writes:

"junkio" == junkio <[email protected]> writes:

junkio> C does not let us declare variables in the middle of a block (yet).

JQ> It depends what do you call C :)
JQ> C99 does.

That is an inappropriate comment in this list. As far as the kernel code is concerned, Documentation/Changes defines what C is :-), and it says "GCC 2.95.3 or later".

Since 2.95.3 does not support declaration-in-the-middle, decl-in-the-middle is not a valid C (yet). On the other hand, other C99 extentions that compiler can grok (e.g. '.FIELDNAME =' style initializer) is now already part of valid C :-).